@adobe/spacecat-shared-http-utils 1.6.18 → 1.7.1
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 +14 -0
- package/package.json +2 -2
- package/src/index.js +14 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-http-utils-v1.7.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-http-utils-v1.7.0...@adobe/spacecat-shared-http-utils-v1.7.1) (2024-11-30)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **deps:** update external fixes ([#465](https://github.com/adobe/spacecat-shared/issues/465)) ([d8ebb23](https://github.com/adobe/spacecat-shared/commit/d8ebb23fbd3d292479a4118dc6a9fb9931a31694))
|
|
7
|
+
|
|
8
|
+
# [@adobe/spacecat-shared-http-utils-v1.7.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-http-utils-v1.6.18...@adobe/spacecat-shared-http-utils-v1.7.0) (2024-11-14)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* Add unauthorized and forbidden to https status codes ([#441](https://github.com/adobe/spacecat-shared/issues/441)) ([ffaa981](https://github.com/adobe/spacecat-shared/commit/ffaa981dd94b834ce164730ef1072b1fe601446d)), closes [/github.com/adobe/spacecat-api-service/pull/569/files#r1841073366](https://github.com//github.com/adobe/spacecat-api-service/pull/569/files/issues/r1841073366)
|
|
14
|
+
|
|
1
15
|
# [@adobe/spacecat-shared-http-utils-v1.6.18](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-http-utils-v1.6.17...@adobe/spacecat-shared-http-utils-v1.6.18) (2024-11-11)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/spacecat-shared-http-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"description": "Shared modules of the Spacecat Services - HTTP Utils",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@adobe/helix-shared-wrap": "2.0.2",
|
|
43
43
|
"chai": "5.1.2",
|
|
44
|
-
"chai-as-promised": "8.0.
|
|
44
|
+
"chai-as-promised": "8.0.1",
|
|
45
45
|
"sinon": "19.0.2"
|
|
46
46
|
}
|
|
47
47
|
}
|
package/src/index.js
CHANGED
|
@@ -74,6 +74,20 @@ export function badRequest(message = 'bad request', headers = {}) {
|
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
export function unauthorized(message = 'unauthorized', headers = {}) {
|
|
78
|
+
return createResponse({ message }, 401, {
|
|
79
|
+
[HEADER_ERROR]: message,
|
|
80
|
+
...headers,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function forbidden(message = 'forbidden', headers = {}) {
|
|
85
|
+
return createResponse({ message }, 403, {
|
|
86
|
+
[HEADER_ERROR]: message,
|
|
87
|
+
...headers,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
77
91
|
export function notFound(message = 'not found', headers = {}) {
|
|
78
92
|
return createResponse({ message }, 404, {
|
|
79
93
|
[HEADER_ERROR]: message,
|