Skip to content
This repository was archived by the owner on May 10, 2021. It is now read-only.

Commit c4b9852

Browse files
committed
Remove multiValueHeaders-workaround for preview mode
In preview mode (using netlify dev), Netlify Functions now receive requests as multiValueHeaders and multiValueQueryStrings. Previously, we needed to manually convert the request to those formats. This now happens automatically.
1 parent 1de3719 commit c4b9852

File tree

2 files changed

+1
-19
lines changed

2 files changed

+1
-19
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ I recommend you still use `next dev` to build and preview your application local
105105

106106
But if you want to emulate the Netlify deployment on your computer, you can also run `next-on-netlify` locally and then use `netlify-cli` to preview the result.
107107

108-
First, install the latest version of `netlify-cli` (you can also [look at package.json](https://github.com/netlify/next-on-netlify/blob/master/package.json) to see the version against which next-on-netlify has been tested):
108+
First, install the latest version of `netlify-cli` (you can also [look at package.json](https://github.com/netlify/next-on-netlify/blob/master/package.json) to see the version that next-on-netlify has been tested against):
109109

110110
```bash
111111
npm install -g netlify-cli

lib/netlifyFunctionTemplate.js

-18
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,6 @@ const callbackHandler = (callback) =>
2424
};
2525

2626
exports.handler = (event, context, callback) => {
27-
// In netlify dev, we currently do not receive headers as multi value headers.
28-
// So we manually set them from the plain headers. This should become
29-
// redundant as soon as https://github.com/netlify/cli/pull/938 is published.
30-
if (!event.hasOwnProperty("multiValueHeaders")) {
31-
event.multiValueHeaders = {};
32-
Object.keys(event.headers).forEach((key) => {
33-
event.multiValueHeaders[key] = [event.headers[key]];
34-
});
35-
}
36-
37-
// In netlify dev, we currently do not receive query string as multi value
38-
// query string. So we manually set it from the plain query string. This
39-
// should become redundant as soon as https://github.com/netlify/cli/pull/938
40-
//is published.
41-
if (!event.hasOwnProperty("multiValueQueryStringParameters")) {
42-
event.multiValueQueryStringParameters = event.queryStringParameters;
43-
}
44-
4527
// Enable support for base64 encoding.
4628
// This is used by next-aws-lambda to determine whether to encode the response
4729
// body as base64.

0 commit comments

Comments
 (0)