[ML] Fixing MS Edge GET request error (#18713) (#18719)

This commit is contained in:
James Gowdy 2018-05-02 17:34:14 +01:00 committed by GitHub
parent 309fc2cd49
commit e19a951594
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -27,12 +27,17 @@ export function http(options) {
const allHeaders = (options.headers === undefined) ? headers : { ...options.headers, ...headers };
const body = (options.data === undefined) ? null : JSON.stringify(options.data);
fetch(url, {
const payload = {
method: (options.method || 'GET'),
headers: (allHeaders),
credentials: 'same-origin',
body,
})
headers: allHeaders,
credentials: 'same-origin'
};
if (body !== null) {
payload.body = body;
}
fetch(url, payload)
.then((resp) => {
resolve(resp.json());
})