Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Commit

Permalink
use application/vnd.flux
Browse files Browse the repository at this point in the history
  • Loading branch information
ryantxu committed Dec 18, 2018
1 parent 9fd5505 commit 1ca0267
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export default class InfluxDatasource {
if (!query) {
return Promise.resolve({data: ''});
}
return this._influxRequest('POST', '/api/v2/query', {query: query}, options);
return this._influxRequest('POST', '/api/v2/query', query, options);
}

testDatasource() {
Expand All @@ -145,7 +145,7 @@ export default class InfluxDatasource {
});
}

return this._influxRequest('POST', '/api/v2/query', {query: query})
return this._influxRequest('POST', '/api/v2/query', query)
.then(res => {
if (res && res.data && res.data.trim()) {
return {
Expand All @@ -164,7 +164,7 @@ export default class InfluxDatasource {
});
}

_influxRequest(method: string, url: string, data: any, options?: any) {
_influxRequest(method: string, url: string, query: string, options?: any) {
let params: any = {};

if (this.username) {
Expand All @@ -176,13 +176,14 @@ export default class InfluxDatasource {
method: method,
url: this.url + url,
params: params,
data: data,
data: query,
precision: 'ms',
inspect: {type: this.type},
};

req.headers = {
Accept: 'application/csv',
'Content-Type': 'application/vnd.flux',
};

if (this.basicAuth || this.withCredentials) {
Expand Down

0 comments on commit 1ca0267

Please sign in to comment.