@adobe/spacecat-shared-http-utils 1.13.2 → 1.14.0
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/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/index.d.ts +4 -0
- package/src/index.js +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-http-utils-v1.14.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-http-utils-v1.13.2...@adobe/spacecat-shared-http-utils-v1.14.0) (2025-05-27)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add 405 response util ([#768](https://github.com/adobe/spacecat-shared/issues/768)) ([300ceb2](https://github.com/adobe/spacecat-shared/commit/300ceb2c979b304849a30f0e227823308d144c40))
|
|
7
|
+
|
|
1
8
|
# [@adobe/spacecat-shared-http-utils-v1.13.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-http-utils-v1.13.1...@adobe/spacecat-shared-http-utils-v1.13.2) (2025-05-21)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { Response } from '@adobe/fetch';
|
|
13
13
|
|
|
14
|
+
export declare function createResponse(body: object, status?: number, headers?: object): Response;
|
|
15
|
+
|
|
14
16
|
export declare function ok(body?: string, headers?: object): Response;
|
|
15
17
|
|
|
16
18
|
export declare function created(body: object, headers?: object): Response;
|
|
@@ -23,6 +25,8 @@ export declare function badRequest(message?: string, headers?: object): Response
|
|
|
23
25
|
|
|
24
26
|
export declare function notFound(message?: string, headers?: object): Response;
|
|
25
27
|
|
|
28
|
+
export declare function methodNotAllowed(message?: string, headers?: object): Response;
|
|
29
|
+
|
|
26
30
|
export declare function internalServerError(message?: string, headers?: object): Response;
|
|
27
31
|
|
|
28
32
|
export declare function found(location: string): Response;
|
package/src/index.js
CHANGED
|
@@ -100,6 +100,13 @@ export function notFound(message = 'not found', headers = {}) {
|
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
export function methodNotAllowed(message = 'method not allowed', headers = {}) {
|
|
104
|
+
return createResponse({ message }, 405, {
|
|
105
|
+
[HEADER_ERROR]: message,
|
|
106
|
+
...headers,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
103
110
|
export function internalServerError(message = 'internal server error', headers = {}) {
|
|
104
111
|
return createResponse({ message }, 500, {
|
|
105
112
|
[HEADER_ERROR]: message,
|