Closed petewins closed 6 years ago
Emh... why dose it say content type application/json?
can you show some code?
This is for an angular project
Import * as _FormData from 'formdata-polyfill';
let data = new _FormData();
let native = new FormData();
console.log('polyfill formdata, data);
console.log('native browser formdata', native);
@petewins The error you get is hinting that you can't send form data as JSON data rather than what the server expects. How do you send data to your server?
Form data (if implemented through form only) is by default POST
ed with application/x-www-form-urlencoded
set as Content-Type
. Better check your server implementation.
Nah @spoike , FormData is normally sent with content type:
multipart/form-data; boundary=----xxxx'
If You send body = new URLSearchParams()
you would get x-www-form-urlencoded
Btw, v3 (released today) now sets the correct content-type header in fetch and xhr if not specified
also calls _blob()
transparently. Maybe you want to try to update the version?
@jimmywarting updated and working
Woop woop, no open issues or PR everything is just perfect
hi all ,
I updated to V3 and same issue occur with me when send angular http post request Content-Type: application/json; charset=utf-8 ?
Please Advise
In the console, the polyfill FormData shows as object Object and the native FormData is object FormData
I believe this causes an error when it hits the server that only accepts multipart-formdata
"{"status":null,"errorCode":400,"errorMessage":"The request could not be understood by the server due to malformed syntax.","response":"Content type 'application/json' not supported"}"