Skip to content

Commit

Permalink
fix: remove rawHaders
Browse files Browse the repository at this point in the history
  • Loading branch information
willfarrell committed Oct 16, 2024
1 parent abe4058 commit 17dd03d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
6 changes: 3 additions & 3 deletions packages/http-header-normalizer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,17 @@ const httpHeaderNormalizerMiddleware = (opts = {}) => {

const httpHeaderNormalizerMiddlewareBefore = async (request) => {
if (request.event.headers) {
const rawHeaders = {}
// const rawHeaders = {}
const headers = { ...defaultHeaders }

for (const key of Object.keys(request.event.headers)) {
rawHeaders[key] = request.event.headers[key]
// rawHeaders[key] = request.event.headers[key]
headers[options.normalizeHeaderKey(key, options.canonical)] =
request.event.headers[key]
}

request.event.headers = headers
request.event.rawHeaders = rawHeaders
// request.event.rawHeaders = rawHeaders
}

if (request.event.multiValueHeaders) {
Expand Down
2 changes: 0 additions & 2 deletions website/docs/middlewares/http-header-normalizer.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ Other middlewares like [`jsonBodyParser`](#jsonbodyparser) or [`urlEncodeBodyPar
will rely on headers to be one of the normalized formats, so if you want to support non-normalized headers in your
app you have to use this middleware before those ones.

This middleware will copy the original headers in `event.rawHeaders`.

## Install

To install this middleware you can use NPM:
Expand Down
2 changes: 1 addition & 1 deletion website/docs/upgrade/5-6.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ No change

### [http-header-normalizer](/docs/middlewares/http-header-normalizer)

No change
- `rawHeaders` is no longer attached to `event`. **Breaking Change**

### [http-json-body-parser](/docs/middlewares/http-json-body-parser)

Expand Down

0 comments on commit 17dd03d

Please sign in to comment.