You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Passing a FormData object to Axios client may result in request header 'Content-Length': 'NaN' being set.
To Reproduce
Given the following code:
// client is an Axios instanceconstpdf=awaitclient.get(pdfUrl,{responseType: 'stream'});constform=newFormData();form.append('file',pdf.data,{ filename,contentType: 'application/pdf'});constres=awaitclient.post(urlToUploadService,form);
Not 100% sure if this is a https://github.com/form-data/form-data issue or an Axios issue, but given it previously worked I though I would register it here.
The text was updated successfully, but these errors were encountered:
Thanks for the report! I can't reproduce the error, but we'll add an isFinite check on our side, just in case. Apparently, there are some unhandled cases under which the method returns NaN instead of calling its callback with an error.
Describe the bug
Passing a FormData object to Axios client may result in request header 'Content-Length': 'NaN' being set.
To Reproduce
Given the following code:
We get the following request header added:
I believe
'Content-Length': 'NaN',
is not something we want :) I'm pretty sure the header was not added with Axios version 1.2.6.I believe this is related code:
axios/lib/adapters/http.js
Lines 266 to 267 in 0b44929
If we log form's getLength:
We'll get a hint of what is going on:
Axios Version
1.3.2
Adapter Version
No response
Browser
No response
Browser Version
No response
Node.js Version
v18.14.0
OS
macos 13.2
Additional Library Versions
No response
Additional context/Screenshots
The text was updated successfully, but these errors were encountered: