Add FormData support for http utility
This commit is contained in:
@@ -10,10 +10,17 @@ const http = {
|
||||
|
||||
const options = {
|
||||
method: method,
|
||||
body: JSON.stringify(data),
|
||||
headers,
|
||||
}
|
||||
|
||||
if (data instanceof FormData) {
|
||||
options.body = data;
|
||||
delete options.headers['Accept'];
|
||||
delete options.headers['Content-Type'];
|
||||
} else {
|
||||
options.body = JSON.stringify(data);
|
||||
}
|
||||
|
||||
if (method === 'GET') {
|
||||
delete options.body;
|
||||
}
|
||||
|
Reference in New Issue
Block a user