@middy/http-header-normalizer 7.6.5 → 7.6.6
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/README.md +1 -1
- package/index.js +8 -3
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
<a href="https://biomejs.dev"><img alt="Checked with Biome" src="https://img.shields.io/badge/Checked_with-Biome-60a5fa?style=flat&logo=biome"></a>
|
|
23
23
|
<a href="https://conventionalcommits.org"><img alt="Conventional Commits" src="https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits&logoColor=white"></a>
|
|
24
24
|
<a href="https://github.com/middyjs/middy/blob/main/package.json#L32">
|
|
25
|
-
<img alt="code coverage" src="https://img.shields.io/badge/code%20coverage-
|
|
25
|
+
<img alt="code coverage" src="https://img.shields.io/badge/code%20coverage-100%25-brightgreen"></a>
|
|
26
26
|
<br/>
|
|
27
27
|
</p>
|
|
28
28
|
<p>You can read the documentation at: <a href="https://middy.js.org/docs/middlewares/http-header-normalizer">https://middy.js.org/docs/middlewares/http-header-normalizer</a></p>
|
package/index.js
CHANGED
|
@@ -112,13 +112,18 @@ const httpHeaderNormalizerMiddleware = (opts = {}) => {
|
|
|
112
112
|
: options.defaultHeaders[key].split(",");
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
// Stryker disable next-line ConditionalExpression,EqualityOperator: micro-optimization only; forcing true merges an empty defaultHeaders object, and Object.assign(Object.create(null), {}) is observably identical to Object.create(null).
|
|
115
116
|
const hasDefaultHeaders = Object.keys(defaultHeaders).length > 0;
|
|
117
|
+
// Stryker disable ConditionalExpression,EqualityOperator: micro-optimization only; forcing true merges an empty defaultMultiValueHeaders object, and Object.assign(Object.create(null), {}) is observably identical to Object.create(null).
|
|
116
118
|
const hasDefaultMultiValueHeaders =
|
|
117
119
|
Object.keys(defaultMultiValueHeaders).length > 0;
|
|
120
|
+
// Stryker restore ConditionalExpression,EqualityOperator
|
|
118
121
|
|
|
119
122
|
const httpHeaderNormalizerMiddlewareBefore = (request) => {
|
|
120
123
|
if (request.event.headers) {
|
|
121
|
-
const headers = hasDefaultHeaders
|
|
124
|
+
const headers = hasDefaultHeaders
|
|
125
|
+
? Object.assign(Object.create(null), defaultHeaders)
|
|
126
|
+
: Object.create(null);
|
|
122
127
|
|
|
123
128
|
for (const key in request.event.headers) {
|
|
124
129
|
headers[cachedNormalizeKey(key)] = request.event.headers[key];
|
|
@@ -129,8 +134,8 @@ const httpHeaderNormalizerMiddleware = (opts = {}) => {
|
|
|
129
134
|
|
|
130
135
|
if (request.event.multiValueHeaders) {
|
|
131
136
|
const headers = hasDefaultMultiValueHeaders
|
|
132
|
-
?
|
|
133
|
-
:
|
|
137
|
+
? Object.assign(Object.create(null), defaultMultiValueHeaders)
|
|
138
|
+
: Object.create(null);
|
|
134
139
|
|
|
135
140
|
for (const key in request.event.multiValueHeaders) {
|
|
136
141
|
headers[cachedNormalizeKey(key)] = request.event.multiValueHeaders[key];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/http-header-normalizer",
|
|
3
|
-
"version": "7.6.
|
|
3
|
+
"version": "7.6.6",
|
|
4
4
|
"description": "HTTP header normalizer middleware for the middy framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
"test": "npm run test:unit && npm run test:fuzz",
|
|
30
30
|
"test:unit": "node --test",
|
|
31
31
|
"test:fuzz": "node --test index.fuzz.js",
|
|
32
|
-
"test:perf": "node --test index.perf.js"
|
|
32
|
+
"test:perf": "node --test index.perf.js",
|
|
33
|
+
"test:mutation": "cd ../.. && MUTATE_PACKAGE=\"$(basename \"$OLDPWD\")\" stryker run"
|
|
33
34
|
},
|
|
34
35
|
"license": "MIT",
|
|
35
36
|
"keywords": [
|
|
@@ -63,8 +64,11 @@
|
|
|
63
64
|
"type": "github",
|
|
64
65
|
"url": "https://github.com/sponsors/willfarrell"
|
|
65
66
|
},
|
|
67
|
+
"dependencies": {
|
|
68
|
+
"@middy/util": "7.6.6"
|
|
69
|
+
},
|
|
66
70
|
"devDependencies": {
|
|
67
|
-
"@middy/core": "7.6.
|
|
71
|
+
"@middy/core": "7.6.6",
|
|
68
72
|
"@types/node": "^22.0.0"
|
|
69
73
|
}
|
|
70
74
|
}
|