@@ -128,13 +128,7 @@ function (angular, _, dateMath) {
128
128
data : reqBody
129
129
} ;
130
130
131
- if ( this . basicAuth || this . withCredentials ) {
132
- options . withCredentials = true ;
133
- }
134
-
135
- if ( this . basicAuth ) {
136
- options . headers = { "Authorization" : this . basicAuth } ;
137
- }
131
+ this . _addCredentialOptions ( options ) ;
138
132
139
133
// In case the backend is 3rd-party hosted and does not suport OPTIONS, urlencoded requests
140
134
// go as POST rather than OPTIONS+POST
@@ -210,11 +204,24 @@ function (angular, _, dateMath) {
210
204
} ;
211
205
212
206
this . _get = function ( relativeUrl , params ) {
213
- return backendSrv . datasourceRequest ( {
207
+ var options = {
214
208
method : 'GET' ,
215
209
url : this . url + relativeUrl ,
216
210
params : params ,
217
- } ) ;
211
+ } ;
212
+
213
+ this . _addCredentialOptions ( options ) ;
214
+
215
+ return backendSrv . datasourceRequest ( options ) ;
216
+ } ;
217
+
218
+ this . _addCredentialOptions = function ( options ) {
219
+ if ( this . basicAuth || this . withCredentials ) {
220
+ options . withCredentials = true ;
221
+ }
222
+ if ( this . basicAuth ) {
223
+ options . headers = { "Authorization" : this . basicAuth } ;
224
+ }
218
225
} ;
219
226
220
227
this . metricFindQuery = function ( query ) {
@@ -435,7 +442,6 @@ function (angular, _, dateMath) {
435
442
date = dateMath . parse ( date , roundUp ) ;
436
443
return date . valueOf ( ) ;
437
444
}
438
-
439
445
}
440
446
441
447
return {
0 commit comments