Fixed issue preventing FormData posting correctly

- Due to migration from Axios, Instances where we were sending FormData
were not considered and always converted to JSON which resulted in empty
JSON bodies.

Related to #1621
This commit is contained in:
Dan Brown 2019-09-03 21:46:46 +01:00
parent 7a4425473b
commit 16d8a667b1
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9

View File

@ -67,7 +67,7 @@ async function dataRequest(method, url, data = null) {
body: data,
};
if (typeof data === 'object') {
if (typeof data === 'object' && !(data instanceof FormData)) {
options.headers = {'Content-Type': 'application/json'};
options.body = JSON.stringify(data);
}