Skip to content

Dev environment differs from production #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kantle opened this issue Dec 29, 2017 · 0 comments
Closed

Dev environment differs from production #2

kantle opened this issue Dec 29, 2017 · 0 comments

Comments

@kantle
Copy link

kantle commented Dec 29, 2017

Hello - I've noticed two issues where this dev environment package differs from the Netlify production environment in how the body of a POST call is treated.

Base64
In the production environment, event.body is a JSON string. In the dev environment, event.body is in Base64 and needs to be decoded into a JSON string. It would be helpful if the event.body was either Base64 or JSON string in both so functions work the same in both environments.

Body Types
The production environment accepts all types of body types (application/json, application/text, etc).
In the dev environment, only application/octet-stream is accepted. If a user POSTS data of say application/json, then that data is disregarded and event.body is an empty object (in Base64). This is due to line 68 of serve.js - app.use(bodyParser.raw()). When no type is specified for raw, the default is type: 'octet-stream'. Recommend a broader set of accepted types or even something like app.use(bodyParser.raw({type: () => true})) to accept all POST types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant