Skip to content
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

Fix: content-length was not matching the body after an array to string conversion #130

Conversation

JonathanJonathanJonathan

Issue: #129
Description of changes:
Recalculate the body length and set the content-length with this new value.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@brettstack
Copy link
Collaborator

Is this causing an issue? Is this the right thing to do? API Gateway converts it again anyway, and at that point the content-length will not match the content that gets returned to the client.

@JonathanJonathanJonathan
Copy link
Author

@brettstack It is causing issues if you run your code locally using https://github.com/awslabs/aws-sam-local I could not find a good workaround. What do you think?

@brettstack
Copy link
Collaborator

Sounds like a SAM Local issue. Do they have binary support? If they don't then it will just result in a base64 string being returned, right?

@brettstack
Copy link
Collaborator

Merged in #147 which fixes this. Thanks!

@brettstack brettstack closed this Jun 22, 2018
brettstack added a commit that referenced this pull request Jun 25, 2018
* Certain requests (e.g. GET and DELETE) would fail when they included a body due to missing content-length header. See #147, #106, #130
brettstack added a commit that referenced this pull request Aug 16, 2018
* Certain requests (e.g. GET and DELETE) would fail when they included a body due to missing content-length header. See #147, #106, #130
brettstack pushed a commit that referenced this pull request Aug 20, 2018
<a name="3.3.5"></a>
## [3.3.5](v3.3.4...v3.3.5) (2018-08-20)

### Bug Fixes

* apply Content-Length header when missing ([b0927b8](b0927b8)), closes [#147](#147) [#106](#106) [#130](#130)
* apply Content-Length header when missing ([#175](#175)) ([c2f416b](c2f416b))
OneDev0411 added a commit to OneDev0411/serverless-express that referenced this pull request Mar 16, 2023
<a name="3.3.5"></a>
## [3.3.5](CodeGenieApp/serverless-express@v3.3.4...v3.3.5) (2018-08-20)

### Bug Fixes

* apply Content-Length header when missing ([b0927b8](CodeGenieApp/serverless-express@b0927b8)), closes [#147](CodeGenieApp/serverless-express#147) [#106](CodeGenieApp/serverless-express#106) [#130](CodeGenieApp/serverless-express#130)
* apply Content-Length header when missing ([#175](CodeGenieApp/serverless-express#175)) ([c2f416b](CodeGenieApp/serverless-express@c2f416b))
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

Successfully merging this pull request may close these issues.

None yet

3 participants