thanks for stopping by.
I want to send a new FormData() as the body of a POST request using the fetch api
new FormData()
body
POST
the operation looks something like this
var formData = new FormData() formData.append('myfile', file, 'someFileName.csv') fetch('https://api.myapp.com', { method: 'POST', headers: { "Content-Type": "multipart/form-data" }, body: formData } )
The solution to the problem is to explicitly set Content-Type to undefined so that your browser or whatever client you're using can set it and add that boundary value in there for you. Disappointing but true.
Content-Type
undefined
1.4m articles
1.4m replys
5 comments
56.9k users