We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
If you try to load an image it will calculate the content-length by taking the length of the body buffer https://github.com/awslabs/aws-serverless-express/blob/500f04ead08ae057062b9bbeb3292eeb46ce54e1/index.js#L59
Later the body buffer is converted to a string, resulting in a different content-length https://github.com/awslabs/aws-serverless-express/blob/500f04ead08ae057062b9bbeb3292eeb46ce54e1/index.js#L84, so the length won't match. Which results in an ERR_CONTENT_LENGTH_MISMATCH error in the browser.
See screenshot:
I fixed it by adding if(isBase64Encoded && typeof headers['content-length'] !== "undefined") { headers['content-length'] = body.length.toString() } after https://github.com/awslabs/aws-serverless-express/blob/500f04ead08ae057062b9bbeb3292eeb46ce54e1/index.js#L84
if(isBase64Encoded && typeof headers['content-length'] !== "undefined") { headers['content-length'] = body.length.toString() }
Not sure if this is a decent fix or if I'm missing something :)
The text was updated successfully, but these errors were encountered:
Closing. This will be merged soon #176
Sorry, something went wrong.
No branches or pull requests
If you try to load an image it will calculate the content-length by taking the length of the body buffer
https://github.com/awslabs/aws-serverless-express/blob/500f04ead08ae057062b9bbeb3292eeb46ce54e1/index.js#L59
Later the body buffer is converted to a string, resulting in a different content-length https://github.com/awslabs/aws-serverless-express/blob/500f04ead08ae057062b9bbeb3292eeb46ce54e1/index.js#L84, so the length won't match. Which results in an ERR_CONTENT_LENGTH_MISMATCH error in the browser.
See screenshot:
I fixed it by adding
if(isBase64Encoded && typeof headers['content-length'] !== "undefined") { headers['content-length'] = body.length.toString() }
after https://github.com/awslabs/aws-serverless-express/blob/500f04ead08ae057062b9bbeb3292eeb46ce54e1/index.js#L84
Not sure if this is a decent fix or if I'm missing something :)
The text was updated successfully, but these errors were encountered: