@arkyn/server 2.0.1-beta.9 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +24 -0
- package/README.md +116 -0
- package/dist/api/deleteRequest.d.ts +13 -0
- package/dist/api/deleteRequest.d.ts.map +1 -0
- package/dist/api/deleteRequest.js +14 -0
- package/dist/api/getRequest.d.ts +12 -0
- package/dist/api/getRequest.d.ts.map +1 -0
- package/dist/api/getRequest.js +13 -0
- package/dist/api/inboxFlowRequest.d.ts +40 -0
- package/dist/api/inboxFlowRequest.d.ts.map +1 -0
- package/dist/api/inboxFlowRequest.js +63 -0
- package/dist/api/makeRequest.d.ts +38 -0
- package/dist/api/makeRequest.d.ts.map +1 -0
- package/dist/api/makeRequest.js +103 -0
- package/dist/api/patchRequest.d.ts +13 -0
- package/dist/api/patchRequest.d.ts.map +1 -0
- package/dist/api/patchRequest.js +14 -0
- package/dist/api/postRequest.d.ts +13 -0
- package/dist/api/postRequest.d.ts.map +1 -0
- package/dist/api/postRequest.js +14 -0
- package/dist/api/putRequest.d.ts +13 -0
- package/dist/api/putRequest.d.ts.map +1 -0
- package/dist/api/putRequest.js +14 -0
- package/dist/config/apiInstance.d.ts +80 -0
- package/dist/config/apiInstance.d.ts.map +1 -0
- package/dist/config/apiInstance.js +111 -0
- package/dist/config/inboxFlowInstance.d.ts +44 -0
- package/dist/config/inboxFlowInstance.d.ts.map +1 -0
- package/dist/config/inboxFlowInstance.js +46 -0
- package/dist/http/badResponses/badGateway.d.ts +23 -0
- package/dist/http/badResponses/badGateway.d.ts.map +1 -1
- package/dist/http/badResponses/badGateway.js +24 -1
- package/dist/http/badResponses/badRequest.d.ts +23 -0
- package/dist/http/badResponses/badRequest.d.ts.map +1 -1
- package/dist/http/badResponses/badRequest.js +24 -1
- package/dist/http/badResponses/conflict.d.ts +23 -0
- package/dist/http/badResponses/conflict.d.ts.map +1 -1
- package/dist/http/badResponses/conflict.js +24 -1
- package/dist/http/badResponses/forbidden.d.ts +23 -0
- package/dist/http/badResponses/forbidden.d.ts.map +1 -1
- package/dist/http/badResponses/forbidden.js +25 -2
- package/dist/http/badResponses/notFound.d.ts +23 -0
- package/dist/http/badResponses/notFound.d.ts.map +1 -1
- package/dist/http/badResponses/notFound.js +24 -1
- package/dist/http/badResponses/notImplemented.d.ts +23 -0
- package/dist/http/badResponses/notImplemented.d.ts.map +1 -1
- package/dist/http/badResponses/notImplemented.js +24 -1
- package/dist/http/badResponses/serverError.d.ts +23 -0
- package/dist/http/badResponses/serverError.d.ts.map +1 -1
- package/dist/http/badResponses/serverError.js +24 -1
- package/dist/http/badResponses/unauthorized.d.ts +23 -0
- package/dist/http/badResponses/unauthorized.d.ts.map +1 -1
- package/dist/http/badResponses/unauthorized.js +24 -1
- package/dist/http/badResponses/unprocessableEntity.d.ts +28 -1
- package/dist/http/badResponses/unprocessableEntity.d.ts.map +1 -1
- package/dist/http/badResponses/unprocessableEntity.js +30 -3
- package/dist/http/successResponses/created.d.ts +25 -0
- package/dist/http/successResponses/created.d.ts.map +1 -1
- package/dist/http/successResponses/created.js +25 -0
- package/dist/http/successResponses/found.d.ts +28 -0
- package/dist/http/successResponses/found.d.ts.map +1 -1
- package/dist/http/successResponses/found.js +28 -0
- package/dist/http/successResponses/noContent.d.ts +16 -1
- package/dist/http/successResponses/noContent.d.ts.map +1 -1
- package/dist/http/successResponses/noContent.js +16 -8
- package/dist/http/successResponses/success.d.ts +25 -0
- package/dist/http/successResponses/success.d.ts.map +1 -1
- package/dist/http/successResponses/success.js +25 -0
- package/dist/http/successResponses/updated.d.ts +25 -0
- package/dist/http/successResponses/updated.d.ts.map +1 -1
- package/dist/http/successResponses/updated.js +25 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/services/decodeErrorMessageFromRequest.d.ts +17 -0
- package/dist/services/decodeErrorMessageFromRequest.d.ts.map +1 -0
- package/dist/services/decodeErrorMessageFromRequest.js +30 -0
- package/dist/services/decodeRequestBody.d.ts.map +1 -1
- package/dist/services/decodeRequestBody.js +12 -16
- package/dist/services/errorHandler.d.ts +42 -1
- package/dist/services/errorHandler.d.ts.map +1 -1
- package/dist/services/errorHandler.js +42 -0
- package/dist/services/formParse.d.ts.map +1 -1
- package/dist/services/formParse.js +4 -2
- package/dist/services/getCaller.d.ts +17 -0
- package/dist/services/getCaller.d.ts.map +1 -0
- package/dist/services/getCaller.js +45 -0
- package/dist/services/httpDebug.d.ts +35 -0
- package/dist/services/httpDebug.d.ts.map +1 -0
- package/dist/services/httpDebug.js +56 -0
- package/dist/services/schemaValidator.d.ts +13 -0
- package/dist/services/schemaValidator.d.ts.map +1 -0
- package/dist/services/schemaValidator.js +51 -0
- package/package.json +11 -5
- package/src/api/deleteRequest.ts +22 -0
- package/src/api/getRequest.ts +20 -0
- package/src/api/inboxFlowRequest.ts +76 -0
- package/src/api/makeRequest.ts +117 -0
- package/src/api/patchRequest.ts +22 -0
- package/src/api/postRequest.ts +22 -0
- package/src/api/putRequest.ts +22 -0
- package/src/config/apiInstance.ts +148 -0
- package/src/config/inboxFlowInstance.ts +65 -0
- package/src/http/badResponses/badGateway.ts +29 -2
- package/src/http/badResponses/badRequest.ts +29 -2
- package/src/http/badResponses/conflict.ts +29 -2
- package/src/http/badResponses/forbidden.ts +30 -3
- package/src/http/badResponses/notFound.ts +29 -2
- package/src/http/badResponses/notImplemented.ts +29 -2
- package/src/http/badResponses/serverError.ts +29 -2
- package/src/http/badResponses/unauthorized.ts +29 -2
- package/src/http/badResponses/unprocessableEntity.ts +33 -2
- package/src/http/successResponses/created.ts +31 -2
- package/src/http/successResponses/found.ts +32 -0
- package/src/http/successResponses/noContent.ts +20 -11
- package/src/http/successResponses/success.ts +31 -2
- package/src/http/successResponses/updated.ts +31 -2
- package/src/index.ts +9 -1
- package/src/services/decodeErrorMessageFromRequest.ts +36 -0
- package/src/services/decodeRequestBody.ts +11 -15
- package/src/services/errorHandler.ts +45 -1
- package/src/services/formParse.ts +4 -5
- package/src/services/getCaller.ts +39 -18
- package/src/services/httpDebug.ts +46 -5
- package/vitest.config.ts +5 -0
- package/dist/http/httpDebug.d.ts +0 -3
- package/dist/http/httpDebug.d.ts.map +0 -1
- package/dist/http/httpDebug.js +0 -15
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { deleteRequest } from "../api/deleteRequest";
|
|
2
|
+
import { getRequest } from "../api/getRequest";
|
|
3
|
+
import { patchRequest } from "../api/patchRequest";
|
|
4
|
+
import { postRequest } from "../api/postRequest";
|
|
5
|
+
import { putRequest } from "../api/putRequest";
|
|
6
|
+
/**
|
|
7
|
+
* Class representing an API instance to handle HTTP requests with base configurations.
|
|
8
|
+
*/
|
|
9
|
+
class ApiInstance {
|
|
10
|
+
baseUrl;
|
|
11
|
+
baseHeaders;
|
|
12
|
+
baseToken;
|
|
13
|
+
/**
|
|
14
|
+
* Creates an instance of ApiInstance.
|
|
15
|
+
* @param props - The configuration properties for the API instance.
|
|
16
|
+
* @param props.baseUrl - The base URL for the API.
|
|
17
|
+
* @param props.baseHeaders - Optional base headers to include in all requests.
|
|
18
|
+
* @param props.baseToken - Optional base token for authorization.
|
|
19
|
+
*/
|
|
20
|
+
constructor(props) {
|
|
21
|
+
this.baseUrl = props.baseUrl;
|
|
22
|
+
this.baseHeaders = props.baseHeaders || undefined;
|
|
23
|
+
this.baseToken = props.baseToken || undefined;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Generates the full URL by appending the route to the base URL.
|
|
27
|
+
* @param route - The route to append to the base URL.
|
|
28
|
+
* @returns The full URL as a string.
|
|
29
|
+
*/
|
|
30
|
+
generateURL(route) {
|
|
31
|
+
return this.baseUrl + route;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Generates the headers for a request by merging base headers, provided headers, and tokens.
|
|
35
|
+
* @param initHeaders - Initial headers to include in the request.
|
|
36
|
+
* @param token - Optional token to override the base token.
|
|
37
|
+
* @returns The merged headers as a HeadersInit object.
|
|
38
|
+
*/
|
|
39
|
+
generateHeaders(initHeaders, token) {
|
|
40
|
+
let headers = {};
|
|
41
|
+
if (this.baseToken)
|
|
42
|
+
headers = { Authorization: `Bearer ${this.baseToken}` };
|
|
43
|
+
if (this.baseHeaders)
|
|
44
|
+
headers = { ...headers, ...this.baseHeaders };
|
|
45
|
+
if (initHeaders)
|
|
46
|
+
headers = { ...headers, ...initHeaders };
|
|
47
|
+
if (token)
|
|
48
|
+
headers = { ...headers, Authorization: `Bearer ${token}` };
|
|
49
|
+
return headers;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Sends a GET request to the specified route.
|
|
53
|
+
* @param route - The API route to send the GET request to.
|
|
54
|
+
* @param data - The request data, including optional headers and token.
|
|
55
|
+
* @returns The API response data.
|
|
56
|
+
*/
|
|
57
|
+
async GET(route, data) {
|
|
58
|
+
const url = this.generateURL(route);
|
|
59
|
+
const headers = this.generateHeaders(data?.headers || {}, data?.token);
|
|
60
|
+
return await getRequest(url, headers);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Sends a POST request to the specified route.
|
|
64
|
+
* @param route - The API route to send the POST request to.
|
|
65
|
+
* @param data - The request data, including body, optional headers, and token.
|
|
66
|
+
* @returns The API response data.
|
|
67
|
+
*/
|
|
68
|
+
async POST(route, data) {
|
|
69
|
+
const url = this.generateURL(route);
|
|
70
|
+
const headers = this.generateHeaders(data?.headers || {}, data?.token);
|
|
71
|
+
const body = data?.body;
|
|
72
|
+
return await postRequest(url, headers, body);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Sends a PUT request to the specified route.
|
|
76
|
+
* @param route - The API route to send the PUT request to.
|
|
77
|
+
* @param data - The request data, including body, optional headers, and token.
|
|
78
|
+
* @returns The API response data.
|
|
79
|
+
*/
|
|
80
|
+
async PUT(route, data) {
|
|
81
|
+
const url = this.generateURL(route);
|
|
82
|
+
const headers = this.generateHeaders(data?.headers || {}, data?.token);
|
|
83
|
+
const body = data?.body;
|
|
84
|
+
return await putRequest(url, headers, body);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Sends a PATCH request to the specified route.
|
|
88
|
+
* @param route - The API route to send the PATCH request to.
|
|
89
|
+
* @param data - The request data, including body, optional headers, and token.
|
|
90
|
+
* @returns The API response data.
|
|
91
|
+
*/
|
|
92
|
+
async PATCH(route, data) {
|
|
93
|
+
const url = this.generateURL(route);
|
|
94
|
+
const headers = this.generateHeaders(data?.headers || {}, data?.token);
|
|
95
|
+
const body = data?.body;
|
|
96
|
+
return await patchRequest(url, headers, body);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Sends a DELETE request to the specified route.
|
|
100
|
+
* @param route - The API route to send the DELETE request to.
|
|
101
|
+
* @param data - The request data, including body, optional headers, and token.
|
|
102
|
+
* @returns The API response data.
|
|
103
|
+
*/
|
|
104
|
+
async DELETE(route, data) {
|
|
105
|
+
const url = this.generateURL(route);
|
|
106
|
+
const headers = this.generateHeaders(data?.headers || {}, data?.token);
|
|
107
|
+
const body = data?.body;
|
|
108
|
+
return await deleteRequest(url, headers, body);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
export { ApiInstance };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
type InboxConfigProps = {
|
|
2
|
+
inboxChannelId: string;
|
|
3
|
+
inboxUserToken: string;
|
|
4
|
+
inboxApiUrl: string;
|
|
5
|
+
};
|
|
6
|
+
type SetInboxConfigProps = {
|
|
7
|
+
inboxChannelId: string;
|
|
8
|
+
inboxUserToken: string;
|
|
9
|
+
inboxApiUrl?: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* The `InboxFlowInstance` class manages the configuration for the inbox flow.
|
|
13
|
+
* It allows you to set and retrieve the inbox configuration, including the channel ID,
|
|
14
|
+
* user token, and API URL.
|
|
15
|
+
*/
|
|
16
|
+
declare class InboxFlowInstance {
|
|
17
|
+
private static inboxConfig?;
|
|
18
|
+
/**
|
|
19
|
+
* Sets the configuration for the inbox. This method initializes the inbox configuration
|
|
20
|
+
* with the provided `inboxConfig` values. If the configuration has already been set,
|
|
21
|
+
* the method will return early without making any changes.
|
|
22
|
+
*
|
|
23
|
+
* @param inboxConfig - An object containing the inbox configuration properties.
|
|
24
|
+
* @param inboxConfig.inboxChannelId - The key used to identify the inbox.
|
|
25
|
+
* @param inboxConfig.inboxUserToken - The user token for authenticating with the inbox.
|
|
26
|
+
* @param inboxConfig.inboxApiUrl - (Optional) The API URL for the inbox. If not provided,
|
|
27
|
+
* a default URL will be used.
|
|
28
|
+
*/
|
|
29
|
+
static setInboxConfig(inboxConfig: SetInboxConfigProps): void;
|
|
30
|
+
/**
|
|
31
|
+
* Retrieves the current inbox configuration for the InboxFlowInstance.
|
|
32
|
+
*
|
|
33
|
+
* @returns {InboxConfigProps | undefined} The current inbox configuration if set,
|
|
34
|
+
* or `undefined` if no configuration has been initialized.
|
|
35
|
+
*/
|
|
36
|
+
static getInboxConfig(): InboxConfigProps | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Resets the inbox configuration to `undefined`.
|
|
39
|
+
* This method can be used to clear the current configuration.
|
|
40
|
+
*/
|
|
41
|
+
static resetInboxConfig(): void;
|
|
42
|
+
}
|
|
43
|
+
export { InboxFlowInstance };
|
|
44
|
+
//# sourceMappingURL=inboxFlowInstance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inboxFlowInstance.d.ts","sourceRoot":"","sources":["../../src/config/inboxFlowInstance.ts"],"names":[],"mappings":"AAAA,KAAK,gBAAgB,GAAG;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;GAIG;AAEH,cAAM,iBAAiB;IACrB,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAmB;IAE9C;;;;;;;;;;OAUG;IAEH,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE,mBAAmB;IAWtD;;;;;OAKG;IACH,MAAM,CAAC,cAAc,IAAI,gBAAgB,GAAG,SAAS;IAIrD;;;OAGG;IAEH,MAAM,CAAC,gBAAgB;CAGxB;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `InboxFlowInstance` class manages the configuration for the inbox flow.
|
|
3
|
+
* It allows you to set and retrieve the inbox configuration, including the channel ID,
|
|
4
|
+
* user token, and API URL.
|
|
5
|
+
*/
|
|
6
|
+
class InboxFlowInstance {
|
|
7
|
+
static inboxConfig;
|
|
8
|
+
/**
|
|
9
|
+
* Sets the configuration for the inbox. This method initializes the inbox configuration
|
|
10
|
+
* with the provided `inboxConfig` values. If the configuration has already been set,
|
|
11
|
+
* the method will return early without making any changes.
|
|
12
|
+
*
|
|
13
|
+
* @param inboxConfig - An object containing the inbox configuration properties.
|
|
14
|
+
* @param inboxConfig.inboxChannelId - The key used to identify the inbox.
|
|
15
|
+
* @param inboxConfig.inboxUserToken - The user token for authenticating with the inbox.
|
|
16
|
+
* @param inboxConfig.inboxApiUrl - (Optional) The API URL for the inbox. If not provided,
|
|
17
|
+
* a default URL will be used.
|
|
18
|
+
*/
|
|
19
|
+
static setInboxConfig(inboxConfig) {
|
|
20
|
+
const defaultInboxURL = `https://logs-inbox-flow-logs.vw6wo7.easypanel.host/api/call`;
|
|
21
|
+
if (!!this.inboxConfig)
|
|
22
|
+
return;
|
|
23
|
+
this.inboxConfig = {
|
|
24
|
+
inboxChannelId: inboxConfig.inboxChannelId,
|
|
25
|
+
inboxUserToken: inboxConfig.inboxUserToken,
|
|
26
|
+
inboxApiUrl: inboxConfig.inboxApiUrl || defaultInboxURL,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Retrieves the current inbox configuration for the InboxFlowInstance.
|
|
31
|
+
*
|
|
32
|
+
* @returns {InboxConfigProps | undefined} The current inbox configuration if set,
|
|
33
|
+
* or `undefined` if no configuration has been initialized.
|
|
34
|
+
*/
|
|
35
|
+
static getInboxConfig() {
|
|
36
|
+
return this.inboxConfig;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Resets the inbox configuration to `undefined`.
|
|
40
|
+
* This method can be used to clear the current configuration.
|
|
41
|
+
*/
|
|
42
|
+
static resetInboxConfig() {
|
|
43
|
+
this.inboxConfig = undefined;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export { InboxFlowInstance };
|
|
@@ -1,10 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents an HTTP error response with a status code of 502 (Bad Gateway).
|
|
3
|
+
* This class is used to standardize the structure of a "Bad Gateway" error response,
|
|
4
|
+
* including the response body, headers, status, and status text.
|
|
5
|
+
*/
|
|
1
6
|
declare class BadGateway {
|
|
2
7
|
body: any;
|
|
3
8
|
cause?: any;
|
|
4
9
|
status: number;
|
|
5
10
|
statusText: string;
|
|
11
|
+
/**
|
|
12
|
+
* Creates an instance of the `BadGateway` class.
|
|
13
|
+
*
|
|
14
|
+
* @param message - A descriptive message explaining the cause of the error.
|
|
15
|
+
* @param cause - Optional additional information about the cause of the error.
|
|
16
|
+
*/
|
|
6
17
|
constructor(message: string, cause?: any);
|
|
18
|
+
/**
|
|
19
|
+
* Converts the `BadGateway` instance into a `Response` object with a JSON body.
|
|
20
|
+
* This method ensures the response has the appropriate headers, status, and status text.
|
|
21
|
+
*
|
|
22
|
+
* @returns A `Response` object with the serialized JSON body and response metadata.
|
|
23
|
+
*/
|
|
7
24
|
toResponse(): Response;
|
|
25
|
+
/**
|
|
26
|
+
* Converts the `BadGateway` instance into a `Response` object using the `Response.json` method.
|
|
27
|
+
* This method is an alternative to `toResponse` for generating JSON error responses.
|
|
28
|
+
*
|
|
29
|
+
* @returns A `Response` object with the JSON body and response metadata.
|
|
30
|
+
*/
|
|
8
31
|
toJson(): Response;
|
|
9
32
|
}
|
|
10
33
|
export { BadGateway };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badGateway.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/badGateway.ts"],"names":[],"mappings":"AAEA,cAAM,UAAU;IACd,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,MAAM,EAAE,MAAM,CAAO;IACrB,UAAU,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"badGateway.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/badGateway.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,cAAM,UAAU;IACd,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,MAAM,EAAE,MAAM,CAAO;IACrB,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;gBAES,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAOxC;;;;;OAKG;IAEH,UAAU,IAAI,QAAQ;IAUtB;;;;;OAKG;IAEH,MAAM,IAAI,QAAQ;CAQnB;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -1,15 +1,32 @@
|
|
|
1
|
-
import { httpDebug } from "
|
|
1
|
+
import { httpDebug } from "../../services/httpDebug";
|
|
2
|
+
/**
|
|
3
|
+
* Represents an HTTP error response with a status code of 502 (Bad Gateway).
|
|
4
|
+
* This class is used to standardize the structure of a "Bad Gateway" error response,
|
|
5
|
+
* including the response body, headers, status, and status text.
|
|
6
|
+
*/
|
|
2
7
|
class BadGateway {
|
|
3
8
|
body;
|
|
4
9
|
cause;
|
|
5
10
|
status = 502;
|
|
6
11
|
statusText;
|
|
12
|
+
/**
|
|
13
|
+
* Creates an instance of the `BadGateway` class.
|
|
14
|
+
*
|
|
15
|
+
* @param message - A descriptive message explaining the cause of the error.
|
|
16
|
+
* @param cause - Optional additional information about the cause of the error.
|
|
17
|
+
*/
|
|
7
18
|
constructor(message, cause) {
|
|
8
19
|
this.body = { name: "BadGateway", message: message };
|
|
9
20
|
this.statusText = message;
|
|
10
21
|
this.cause = cause ? JSON.stringify(cause) : undefined;
|
|
11
22
|
httpDebug("BadGateway", this.body, this.cause);
|
|
12
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Converts the `BadGateway` instance into a `Response` object with a JSON body.
|
|
26
|
+
* This method ensures the response has the appropriate headers, status, and status text.
|
|
27
|
+
*
|
|
28
|
+
* @returns A `Response` object with the serialized JSON body and response metadata.
|
|
29
|
+
*/
|
|
13
30
|
toResponse() {
|
|
14
31
|
const responseInit = {
|
|
15
32
|
headers: { "Content-Type": "application/json" },
|
|
@@ -18,6 +35,12 @@ class BadGateway {
|
|
|
18
35
|
};
|
|
19
36
|
return new Response(JSON.stringify(this.body), responseInit);
|
|
20
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Converts the `BadGateway` instance into a `Response` object using the `Response.json` method.
|
|
40
|
+
* This method is an alternative to `toResponse` for generating JSON error responses.
|
|
41
|
+
*
|
|
42
|
+
* @returns A `Response` object with the JSON body and response metadata.
|
|
43
|
+
*/
|
|
21
44
|
toJson() {
|
|
22
45
|
const responseInit = {
|
|
23
46
|
status: this.status,
|
|
@@ -1,10 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents an HTTP error response with a status code of 400 (Bad Request).
|
|
3
|
+
* This class is used to standardize the structure of a "Bad Request" error response,
|
|
4
|
+
* including the response body, headers, status, and status text.
|
|
5
|
+
*/
|
|
1
6
|
declare class BadRequest {
|
|
2
7
|
body: any;
|
|
3
8
|
cause?: any;
|
|
4
9
|
status: number;
|
|
5
10
|
statusText: string;
|
|
11
|
+
/**
|
|
12
|
+
* Creates an instance of the `BadRequest` class.
|
|
13
|
+
*
|
|
14
|
+
* @param message - A descriptive message explaining the cause of the error.
|
|
15
|
+
* @param cause - Optional additional information about the cause of the error.
|
|
16
|
+
*/
|
|
6
17
|
constructor(message: string, cause?: any);
|
|
18
|
+
/**
|
|
19
|
+
* Converts the `BadRequest` instance into a `Response` object with a JSON body.
|
|
20
|
+
* This method ensures the response has the appropriate headers, status, and status text.
|
|
21
|
+
*
|
|
22
|
+
* @returns A `Response` object with the serialized JSON body and response metadata.
|
|
23
|
+
*/
|
|
7
24
|
toResponse(): Response;
|
|
25
|
+
/**
|
|
26
|
+
* Converts the `BadRequest` instance into a `Response` object using the `Response.json` method.
|
|
27
|
+
* This method is an alternative to `toResponse` for generating JSON error responses.
|
|
28
|
+
*
|
|
29
|
+
* @returns A `Response` object with the JSON body and response metadata.
|
|
30
|
+
*/
|
|
8
31
|
toJson(): Response;
|
|
9
32
|
}
|
|
10
33
|
export { BadRequest };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badRequest.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/badRequest.ts"],"names":[],"mappings":"AAEA,cAAM,UAAU;IACd,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,MAAM,EAAE,MAAM,CAAO;IACrB,UAAU,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"badRequest.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/badRequest.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,cAAM,UAAU;IACd,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,MAAM,EAAE,MAAM,CAAO;IACrB,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;gBAES,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAOxC;;;;;OAKG;IAEH,UAAU,IAAI,QAAQ;IAUtB;;;;;OAKG;IAEH,MAAM,IAAI,QAAQ;CAQnB;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -1,15 +1,32 @@
|
|
|
1
|
-
import { httpDebug } from "
|
|
1
|
+
import { httpDebug } from "../../services/httpDebug";
|
|
2
|
+
/**
|
|
3
|
+
* Represents an HTTP error response with a status code of 400 (Bad Request).
|
|
4
|
+
* This class is used to standardize the structure of a "Bad Request" error response,
|
|
5
|
+
* including the response body, headers, status, and status text.
|
|
6
|
+
*/
|
|
2
7
|
class BadRequest {
|
|
3
8
|
body;
|
|
4
9
|
cause;
|
|
5
10
|
status = 400;
|
|
6
11
|
statusText;
|
|
12
|
+
/**
|
|
13
|
+
* Creates an instance of the `BadRequest` class.
|
|
14
|
+
*
|
|
15
|
+
* @param message - A descriptive message explaining the cause of the error.
|
|
16
|
+
* @param cause - Optional additional information about the cause of the error.
|
|
17
|
+
*/
|
|
7
18
|
constructor(message, cause) {
|
|
8
19
|
this.body = { name: "BadRequest", message: message };
|
|
9
20
|
this.statusText = message;
|
|
10
21
|
this.cause = cause ? JSON.stringify(cause) : undefined;
|
|
11
22
|
httpDebug("BadRequest", this.body, this.cause);
|
|
12
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Converts the `BadRequest` instance into a `Response` object with a JSON body.
|
|
26
|
+
* This method ensures the response has the appropriate headers, status, and status text.
|
|
27
|
+
*
|
|
28
|
+
* @returns A `Response` object with the serialized JSON body and response metadata.
|
|
29
|
+
*/
|
|
13
30
|
toResponse() {
|
|
14
31
|
const responseInit = {
|
|
15
32
|
headers: { "Content-Type": "application/json" },
|
|
@@ -18,6 +35,12 @@ class BadRequest {
|
|
|
18
35
|
};
|
|
19
36
|
return new Response(JSON.stringify(this.body), responseInit);
|
|
20
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Converts the `BadRequest` instance into a `Response` object using the `Response.json` method.
|
|
40
|
+
* This method is an alternative to `toResponse` for generating JSON error responses.
|
|
41
|
+
*
|
|
42
|
+
* @returns A `Response` object with the JSON body and response metadata.
|
|
43
|
+
*/
|
|
21
44
|
toJson() {
|
|
22
45
|
const responseInit = {
|
|
23
46
|
status: this.status,
|
|
@@ -1,10 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents an HTTP error response with a status code of 409 (Conflict).
|
|
3
|
+
* This class is used to standardize the structure of a "Conflict" error response,
|
|
4
|
+
* including the response body, headers, status, and status text.
|
|
5
|
+
*/
|
|
1
6
|
declare class Conflict {
|
|
2
7
|
body: any;
|
|
3
8
|
cause?: any;
|
|
4
9
|
status: number;
|
|
5
10
|
statusText: string;
|
|
11
|
+
/**
|
|
12
|
+
* Creates an instance of the `Conflict` class.
|
|
13
|
+
*
|
|
14
|
+
* @param message - A descriptive message explaining the cause of the conflict.
|
|
15
|
+
* @param cause - Optional additional information about the cause of the conflict.
|
|
16
|
+
*/
|
|
6
17
|
constructor(message: string, cause?: any);
|
|
18
|
+
/**
|
|
19
|
+
* Converts the `Conflict` instance into a `Response` object with a JSON body.
|
|
20
|
+
* This method ensures the response has the appropriate headers, status, and status text.
|
|
21
|
+
*
|
|
22
|
+
* @returns A `Response` object with the serialized JSON body and response metadata.
|
|
23
|
+
*/
|
|
7
24
|
toResponse(): Response;
|
|
25
|
+
/**
|
|
26
|
+
* Converts the `Conflict` instance into a `Response` object using the `Response.json` method.
|
|
27
|
+
* This method is an alternative to `toResponse` for generating JSON error responses.
|
|
28
|
+
*
|
|
29
|
+
* @returns A `Response` object with the JSON body and response metadata.
|
|
30
|
+
*/
|
|
8
31
|
toJson(): Response;
|
|
9
32
|
}
|
|
10
33
|
export { Conflict };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conflict.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/conflict.ts"],"names":[],"mappings":"AAEA,cAAM,QAAQ;IACZ,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,MAAM,EAAE,MAAM,CAAO;IACrB,UAAU,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"conflict.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/conflict.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,cAAM,QAAQ;IACZ,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,MAAM,EAAE,MAAM,CAAO;IACrB,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;gBAES,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAOxC;;;;;OAKG;IAEH,UAAU,IAAI,QAAQ;IAUtB;;;;;OAKG;IAEH,MAAM,IAAI,QAAQ;CAQnB;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1,15 +1,32 @@
|
|
|
1
|
-
import { httpDebug } from "
|
|
1
|
+
import { httpDebug } from "../../services/httpDebug";
|
|
2
|
+
/**
|
|
3
|
+
* Represents an HTTP error response with a status code of 409 (Conflict).
|
|
4
|
+
* This class is used to standardize the structure of a "Conflict" error response,
|
|
5
|
+
* including the response body, headers, status, and status text.
|
|
6
|
+
*/
|
|
2
7
|
class Conflict {
|
|
3
8
|
body;
|
|
4
9
|
cause;
|
|
5
10
|
status = 409;
|
|
6
11
|
statusText;
|
|
12
|
+
/**
|
|
13
|
+
* Creates an instance of the `Conflict` class.
|
|
14
|
+
*
|
|
15
|
+
* @param message - A descriptive message explaining the cause of the conflict.
|
|
16
|
+
* @param cause - Optional additional information about the cause of the conflict.
|
|
17
|
+
*/
|
|
7
18
|
constructor(message, cause) {
|
|
8
19
|
this.body = { name: "Conflict", message: message };
|
|
9
20
|
this.statusText = message;
|
|
10
21
|
this.cause = cause ? JSON.stringify(cause) : undefined;
|
|
11
22
|
httpDebug("Conflict", this.body, this.cause);
|
|
12
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Converts the `Conflict` instance into a `Response` object with a JSON body.
|
|
26
|
+
* This method ensures the response has the appropriate headers, status, and status text.
|
|
27
|
+
*
|
|
28
|
+
* @returns A `Response` object with the serialized JSON body and response metadata.
|
|
29
|
+
*/
|
|
13
30
|
toResponse() {
|
|
14
31
|
const responseInit = {
|
|
15
32
|
headers: { "Content-Type": "application/json" },
|
|
@@ -18,6 +35,12 @@ class Conflict {
|
|
|
18
35
|
};
|
|
19
36
|
return new Response(JSON.stringify(this.body), responseInit);
|
|
20
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Converts the `Conflict` instance into a `Response` object using the `Response.json` method.
|
|
40
|
+
* This method is an alternative to `toResponse` for generating JSON error responses.
|
|
41
|
+
*
|
|
42
|
+
* @returns A `Response` object with the JSON body and response metadata.
|
|
43
|
+
*/
|
|
21
44
|
toJson() {
|
|
22
45
|
const responseInit = {
|
|
23
46
|
status: this.status,
|
|
@@ -1,10 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents an HTTP error response with a status code of 403 (Forbidden).
|
|
3
|
+
* This class is used to standardize the structure of a "Forbidden" error response,
|
|
4
|
+
* including the response body, headers, status, and status text.
|
|
5
|
+
*/
|
|
1
6
|
declare class Forbidden {
|
|
2
7
|
body: any;
|
|
3
8
|
cause?: any;
|
|
4
9
|
status: number;
|
|
5
10
|
statusText: string;
|
|
11
|
+
/**
|
|
12
|
+
* Creates an instance of the `Forbidden` class.
|
|
13
|
+
*
|
|
14
|
+
* @param message - A descriptive message explaining why access is forbidden.
|
|
15
|
+
* @param cause - Optional additional information about the cause of the error.
|
|
16
|
+
*/
|
|
6
17
|
constructor(message: string, cause?: any);
|
|
18
|
+
/**
|
|
19
|
+
* Converts the `Forbidden` instance into a `Response` object with a JSON body.
|
|
20
|
+
* This method ensures the response has the appropriate headers, status, and status text.
|
|
21
|
+
*
|
|
22
|
+
* @returns A `Response` object with the serialized JSON body and response metadata.
|
|
23
|
+
*/
|
|
7
24
|
toResponse(): Response;
|
|
25
|
+
/**
|
|
26
|
+
* Converts the `Forbidden` instance into a `Response` object using the `Response.json` method.
|
|
27
|
+
* This method is an alternative to `toResponse` for generating JSON error responses.
|
|
28
|
+
*
|
|
29
|
+
* @returns A `Response` object with the JSON body and response metadata.
|
|
30
|
+
*/
|
|
8
31
|
toJson(): Response;
|
|
9
32
|
}
|
|
10
33
|
export { Forbidden };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forbidden.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/forbidden.ts"],"names":[],"mappings":"AAEA,cAAM,SAAS;IACb,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,MAAM,EAAE,MAAM,CAAO;IACrB,UAAU,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"forbidden.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/forbidden.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,cAAM,SAAS;IACb,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,MAAM,EAAE,MAAM,CAAO;IACrB,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;gBAES,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAOxC;;;;;OAKG;IAEH,UAAU,IAAI,QAAQ;IAUtB;;;;;OAKG;IAEH,MAAM,IAAI,QAAQ;CAQnB;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1,15 +1,32 @@
|
|
|
1
|
-
import { httpDebug } from "
|
|
1
|
+
import { httpDebug } from "../../services/httpDebug";
|
|
2
|
+
/**
|
|
3
|
+
* Represents an HTTP error response with a status code of 403 (Forbidden).
|
|
4
|
+
* This class is used to standardize the structure of a "Forbidden" error response,
|
|
5
|
+
* including the response body, headers, status, and status text.
|
|
6
|
+
*/
|
|
2
7
|
class Forbidden {
|
|
3
8
|
body;
|
|
4
9
|
cause;
|
|
5
|
-
status =
|
|
10
|
+
status = 403;
|
|
6
11
|
statusText;
|
|
12
|
+
/**
|
|
13
|
+
* Creates an instance of the `Forbidden` class.
|
|
14
|
+
*
|
|
15
|
+
* @param message - A descriptive message explaining why access is forbidden.
|
|
16
|
+
* @param cause - Optional additional information about the cause of the error.
|
|
17
|
+
*/
|
|
7
18
|
constructor(message, cause) {
|
|
8
19
|
this.body = { name: "Forbidden", message: message };
|
|
9
20
|
this.statusText = message;
|
|
10
21
|
this.cause = cause ? JSON.stringify(cause) : undefined;
|
|
11
22
|
httpDebug("Forbidden", this.body, this.cause);
|
|
12
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Converts the `Forbidden` instance into a `Response` object with a JSON body.
|
|
26
|
+
* This method ensures the response has the appropriate headers, status, and status text.
|
|
27
|
+
*
|
|
28
|
+
* @returns A `Response` object with the serialized JSON body and response metadata.
|
|
29
|
+
*/
|
|
13
30
|
toResponse() {
|
|
14
31
|
const responseInit = {
|
|
15
32
|
headers: { "Content-Type": "application/json" },
|
|
@@ -18,6 +35,12 @@ class Forbidden {
|
|
|
18
35
|
};
|
|
19
36
|
return new Response(JSON.stringify(this.body), responseInit);
|
|
20
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Converts the `Forbidden` instance into a `Response` object using the `Response.json` method.
|
|
40
|
+
* This method is an alternative to `toResponse` for generating JSON error responses.
|
|
41
|
+
*
|
|
42
|
+
* @returns A `Response` object with the JSON body and response metadata.
|
|
43
|
+
*/
|
|
21
44
|
toJson() {
|
|
22
45
|
const responseInit = {
|
|
23
46
|
status: this.status,
|
|
@@ -1,10 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents an HTTP error response with a status code of 404 (Not Found).
|
|
3
|
+
* This class is used to standardize the structure of a "Not Found" error response,
|
|
4
|
+
* including the response body, headers, status, and status text.
|
|
5
|
+
*/
|
|
1
6
|
declare class NotFound {
|
|
2
7
|
body: any;
|
|
3
8
|
cause?: any;
|
|
4
9
|
status: number;
|
|
5
10
|
statusText: string;
|
|
11
|
+
/**
|
|
12
|
+
* Creates an instance of the `NotFound` class.
|
|
13
|
+
*
|
|
14
|
+
* @param message - A descriptive message explaining the reason the resource was not found.
|
|
15
|
+
* @param cause - Optional additional information about the cause of the error.
|
|
16
|
+
*/
|
|
6
17
|
constructor(message: string, cause?: any);
|
|
18
|
+
/**
|
|
19
|
+
* Converts the `NotFound` instance into a `Response` object with a JSON body.
|
|
20
|
+
* This method ensures the response has the appropriate headers, status, and status text.
|
|
21
|
+
*
|
|
22
|
+
* @returns A `Response` object with the serialized JSON body and response metadata.
|
|
23
|
+
*/
|
|
7
24
|
toResponse(): Response;
|
|
25
|
+
/**
|
|
26
|
+
* Converts the `NotFound` instance into a `Response` object using the `Response.json` method.
|
|
27
|
+
* This method is an alternative to `toResponse` for generating JSON error responses.
|
|
28
|
+
*
|
|
29
|
+
* @returns A `Response` object with the JSON body and response metadata.
|
|
30
|
+
*/
|
|
8
31
|
toJson(): Response;
|
|
9
32
|
}
|
|
10
33
|
export { NotFound };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notFound.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/notFound.ts"],"names":[],"mappings":"AAEA,cAAM,QAAQ;IACZ,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,MAAM,EAAE,MAAM,CAAO;IACrB,UAAU,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"notFound.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/notFound.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,cAAM,QAAQ;IACZ,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,MAAM,EAAE,MAAM,CAAO;IACrB,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;gBAES,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAOxC;;;;;OAKG;IAEH,UAAU,IAAI,QAAQ;IAUtB;;;;;OAKG;IAEH,MAAM,IAAI,QAAQ;CAQnB;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1,15 +1,32 @@
|
|
|
1
|
-
import { httpDebug } from "
|
|
1
|
+
import { httpDebug } from "../../services/httpDebug";
|
|
2
|
+
/**
|
|
3
|
+
* Represents an HTTP error response with a status code of 404 (Not Found).
|
|
4
|
+
* This class is used to standardize the structure of a "Not Found" error response,
|
|
5
|
+
* including the response body, headers, status, and status text.
|
|
6
|
+
*/
|
|
2
7
|
class NotFound {
|
|
3
8
|
body;
|
|
4
9
|
cause;
|
|
5
10
|
status = 404;
|
|
6
11
|
statusText;
|
|
12
|
+
/**
|
|
13
|
+
* Creates an instance of the `NotFound` class.
|
|
14
|
+
*
|
|
15
|
+
* @param message - A descriptive message explaining the reason the resource was not found.
|
|
16
|
+
* @param cause - Optional additional information about the cause of the error.
|
|
17
|
+
*/
|
|
7
18
|
constructor(message, cause) {
|
|
8
19
|
this.body = { name: "NotFound", message: message };
|
|
9
20
|
this.statusText = message;
|
|
10
21
|
this.cause = cause ? JSON.stringify(cause) : undefined;
|
|
11
22
|
httpDebug("NotFound", this.body, this.cause);
|
|
12
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Converts the `NotFound` instance into a `Response` object with a JSON body.
|
|
26
|
+
* This method ensures the response has the appropriate headers, status, and status text.
|
|
27
|
+
*
|
|
28
|
+
* @returns A `Response` object with the serialized JSON body and response metadata.
|
|
29
|
+
*/
|
|
13
30
|
toResponse() {
|
|
14
31
|
const responseInit = {
|
|
15
32
|
headers: { "Content-Type": "application/json" },
|
|
@@ -18,6 +35,12 @@ class NotFound {
|
|
|
18
35
|
};
|
|
19
36
|
return new Response(JSON.stringify(this.body), responseInit);
|
|
20
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Converts the `NotFound` instance into a `Response` object using the `Response.json` method.
|
|
40
|
+
* This method is an alternative to `toResponse` for generating JSON error responses.
|
|
41
|
+
*
|
|
42
|
+
* @returns A `Response` object with the JSON body and response metadata.
|
|
43
|
+
*/
|
|
21
44
|
toJson() {
|
|
22
45
|
const responseInit = {
|
|
23
46
|
status: this.status,
|