GET unless POSTing data

This commit is contained in:
Alex Yatskov 2016-12-29 11:10:12 -08:00
parent b9363dc979
commit 6c940656ca

View File

@ -155,9 +155,14 @@ class AnkiWeb {
const xhr = new XMLHttpRequest();
xhr.addEventListener('error', () => reject('failed to execute network request'));
xhr.addEventListener('load', () => resolve(xhr.responseText));
if (dataEnc) {
xhr.open('POST', url);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.send(dataEnc);
} else {
xhr.open('GET', url);
xhr.send();
}
});
}
}