Browser:
Chromium 72.0.3626.81
I was not able reproduce the issue with Firefox, nor Vivaldi.
Language:
ESNext
Current behavior:
When using a FormData object as the body parameter for a query, the Content-Length header sometimes doesn't get set at all.
The body is sent as expected: I checked for that. But as there is no Content-Length header, most servers will act as if the query was sent with an empty body.
In the following example, as long as the user doesn't input any file in the pictures field, the query will be sent with a Content-Length.
However, if some files are uploaded, there's a chance that the Content-Length won't be set. It all depends on the specific files that are uploaded: I haven't been able to identify why, but some files aren't problematic, while others are.
Most of the files in my picture folder are affected by this issue. I've uploaded one for test purposes (and I did check that the issue still happened with the uploaded version):
https://imagebin.ca/v/4WKYl7PyYMLM
Here's the code I've been using to reproduce the issue:
formTest.html
I'm submitting a bug report
Please tell us about your environment:
Operating System: Linux (Arch)
Node Version: 11.9.0
NPM Version: 6.7.0
JSPM OR Webpack AND Version None.
Browser: Chromium 72.0.3626.81 I was not able reproduce the issue with Firefox, nor Vivaldi.
Language: ESNext
Current behavior: When using a FormData object as the body parameter for a query, the Content-Length header sometimes doesn't get set at all. The body is sent as expected: I checked for that. But as there is no Content-Length header, most servers will act as if the query was sent with an empty body.
In the following example, as long as the user doesn't input any file in the
pictures
field, the query will be sent with a Content-Length. However, if some files are uploaded, there's a chance that the Content-Length won't be set. It all depends on the specific files that are uploaded: I haven't been able to identify why, but some files aren't problematic, while others are.Most of the files in my picture folder are affected by this issue. I've uploaded one for test purposes (and I did check that the issue still happened with the uploaded version): https://imagebin.ca/v/4WKYl7PyYMLM
Here's the code I've been using to reproduce the issue:
formTest.html
formTest.js
Expected/desired behavior: The outgoing query with multipart/form-data content should always have a Content-Length set.