From 50d46c8ebdd67526499b695b470ca60e97a11272 Mon Sep 17 00:00:00 2001 From: Greg Schueler Date: Thu, 1 Nov 2018 09:49:07 -0700 Subject: [PATCH] Only add synch tokens for non-get, set accept --- src/rundeckBrowser.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/rundeckBrowser.ts b/src/rundeckBrowser.ts index 0f8548a..577a5ab 100644 --- a/src/rundeckBrowser.ts +++ b/src/rundeckBrowser.ts @@ -28,17 +28,24 @@ export class RundeckBrowser extends Rundeck { let reqAction = () => { if (options instanceof WebResource) { options.headers.set('X-RUNDECK-AJAX', 'true') - options.headers.set('X-RUNDECK-TOKEN-URI', this.uri!) - options.headers.set('X-RUNDECK-TOKEN-KEY', this.token!) const accept = options.headers.get('Accept') if (!accept) { options.headers.set('Accept', 'application/json; charset=utf-8') } + + if(options.method !== 'GET'){ + options.headers.set('X-RUNDECK-TOKEN-URI', this.uri!) + options.headers.set('X-RUNDECK-TOKEN-KEY', this.token!) + } } else { options.headers = { 'X-RUNDECK-AJAX': 'true', - 'X-RUNDECK-TOKEN-URI': this.uri!, - 'X-RUNDECK-TOKEN-KEY': this.token!, + 'Accept': 'application/json; charset=utf-8', + } + + if(options.method !== 'GET'){ + options.headers['X-RUNDECK-TOKEN-URI'] = this.uri! + options.headers['X-RUNDECK-TOKEN-KEY'] = this.token! } }