]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1380437 follow-up - Send API token only if available
authorKohei Yoshino <kohei.yoshino@gmail.com>
Thu, 11 Jul 2019 15:05:33 +0000 (11:05 -0400)
committerGitHub <noreply@github.com>
Thu, 11 Jul 2019 15:05:33 +0000 (11:05 -0400)
js/util.js

index 5f937444876a36f6885153085b8df8ddc3ad006f..c071f7c2825f1fad9894546121f7e67ecdcbb430 100644 (file)
@@ -391,6 +391,7 @@ Bugzilla.API = class API {
    */
   static _init(endpoint, method = 'GET', params = {}) {
     const url = new URL(`${BUGZILLA.config.basepath}rest/${endpoint}`, location.origin);
+    const token = BUGZILLA.api_token;
 
     if (method === 'GET') {
       for (const [key, value] of Object.entries(params)) {
@@ -410,7 +411,9 @@ Bugzilla.API = class API {
     }
 
     /** @todo Remove this once Bug 1477163 is solved */
-    url.searchParams.set('Bugzilla_api_token', BUGZILLA.api_token);
+    if (token) {
+      url.searchParams.set('Bugzilla_api_token', token);
+    }
 
     return new Request(url, {
       method,