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

This commit is contained in:
James Gowdy 2018-05-02 14:25:17 +01:00 committed by GitHub
parent 34cc14f445
commit d77cc5676b
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());
})