From 6c940656ca5ec5a004d402ffd2fcd9a148bd71b4 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Thu, 29 Dec 2016 11:10:12 -0800 Subject: [PATCH] GET unless POSTing data --- ext/bg/js/ankiweb.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ext/bg/js/ankiweb.js b/ext/bg/js/ankiweb.js index dc6a5d49..6a45b9c5 100644 --- a/ext/bg/js/ankiweb.js +++ b/ext/bg/js/ankiweb.js @@ -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)); - xhr.open('POST', url); - xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); - xhr.send(dataEnc); + 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(); + } }); } }