@middy/http-header-normalizer 3.0.0 → 3.0.3
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 +1 -1
- package/README.md +4 -3
- package/index.cjs +1 -1
- package/package.json +3 -3
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2017-2022 Luciano Mammino, will Farrell and the [Middy team](https://github.com/middyjs/middy/graphs/contributors)
|
|
3
|
+
Copyright (c) 2017-2022 [Luciano Mammino](https://github.com/lmammino), [will Farrell](https://github.com/willfarrell) and the [Middy team](https://github.com/middyjs/middy/graphs/contributors)
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
<a href="https://packagephobia.com/result?p=@middy/http-header-normalizer">
|
|
10
10
|
<img src="https://packagephobia.com/badge?p=@middy/http-header-normalizer" alt="npm install size" style="max-width:100%;">
|
|
11
11
|
</a>
|
|
12
|
-
<a href="https://github.com/middyjs/middy/actions">
|
|
13
|
-
<img src="https://github.com/middyjs/middy/workflows/
|
|
12
|
+
<a href="https://github.com/middyjs/middy/actions/workflows/tests.yml">
|
|
13
|
+
<img src="https://github.com/middyjs/middy/actions/workflows/tests.yml/badge.svg?branch=main&event=push" alt="GitHub Actions CI status badge" style="max-width:100%;">
|
|
14
14
|
</a>
|
|
15
15
|
<br/>
|
|
16
16
|
<a href="https://standardjs.com/">
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
<img src="https://img.shields.io/badge/StackOverflow-[middy]-yellow" alt="Ask questions on StackOverflow" style="max-width:100%;">
|
|
34
34
|
</a>
|
|
35
35
|
</p>
|
|
36
|
+
<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>
|
|
36
37
|
</div>
|
|
37
38
|
|
|
38
39
|
This middleware normalizes HTTP header names to their canonical format. Very useful if clients are
|
|
@@ -90,7 +91,7 @@ Everyone is very welcome to contribute to this repository. Feel free to [raise i
|
|
|
90
91
|
|
|
91
92
|
## License
|
|
92
93
|
|
|
93
|
-
Licensed under [MIT License](LICENSE). Copyright (c) 2017-2022 Luciano Mammino, will Farrell, and the [Middy team](https://github.com/middyjs/middy/graphs/contributors).
|
|
94
|
+
Licensed under [MIT License](LICENSE). Copyright (c) 2017-2022 [Luciano Mammino](https://github.com/lmammino), [will Farrell](https://github.com/willfarrell), and the [Middy team](https://github.com/middyjs/middy/graphs/contributors).
|
|
94
95
|
|
|
95
96
|
<a href="https://app.fossa.io/projects/git%2Bgithub.com%2Fmiddyjs%2Fmiddy?ref=badge_large">
|
|
96
97
|
<img src="https://app.fossa.io/api/projects/git%2Bgithub.com%2Fmiddyjs%2Fmiddy.svg?type=large" alt="FOSSA Status" style="max-width:100%;">
|
package/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});module.exports=void 0;const exceptionsList=["ALPN","C-PEP","C-PEP-Info","CalDAV-Timezones","Content-ID","Content-MD5","DASL","DAV","DNT","ETag","GetProfile","HTTP2-Settings","Last-Event-ID","MIME-Version","Optional-WWW-Authenticate","Sec-WebSocket-Accept","Sec-WebSocket-Extensions","Sec-WebSocket-Key","Sec-WebSocket-Protocol","Sec-WebSocket-Version","SLUG","TCN","TE","TTL","WWW-Authenticate","X-ATT-DeviceId","X-DNSPrefetch-Control","X-UIDH"];const exceptions=exceptionsList.reduce((acc,curr)=>{acc[curr.toLowerCase()]=curr;return acc},{});const normalizeHeaderKey=(key,canonical)=>{const lowerCaseKey=key.toLowerCase();if(!canonical){return lowerCaseKey}if(exceptions[lowerCaseKey]){return exceptions[lowerCaseKey]}return lowerCaseKey.split("-").map(text=>text[0].toUpperCase()+text.substr(1)).join("-")};const defaults={canonical:false,normalizeHeaderKey};const httpHeaderNormalizerMiddleware=(opts={})=>{const options={...defaults,...opts};const httpHeaderNormalizerMiddlewareBefore=async request=>{if(request.event.headers){const rawHeaders={};const headers={};for(const key of Object.keys(request.event.headers)){rawHeaders[key]=request.event.headers[key];headers[options.normalizeHeaderKey(key,options.canonical)]=request.event.headers[key]}request.event.headers=headers;request.event.rawHeaders=rawHeaders}if(request.event.multiValueHeaders){const rawHeaders={};const headers={};for(const key of Object.keys(request.event.multiValueHeaders)){rawHeaders[key]=request.event.multiValueHeaders[key];headers[options.normalizeHeaderKey(key,options.canonical)]=request.event.multiValueHeaders[key]}request.event.multiValueHeaders=headers;request.event.rawMultiValueHeaders=rawHeaders}};return{before:httpHeaderNormalizerMiddlewareBefore}};var _default=httpHeaderNormalizerMiddleware;module.exports=_default
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=index.cjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/http-header-normalizer",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"description": "Http header normalizer middleware for the middy framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"url": "https://github.com/middyjs/middy/issues"
|
|
57
57
|
},
|
|
58
58
|
"homepage": "https://middy.js.org",
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "ea9e5e8cce754d0c467c7dd3ac9a7601149efea2",
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@middy/core": "
|
|
61
|
+
"@middy/core": "3.0.3"
|
|
62
62
|
}
|
|
63
63
|
}
|