@cubejs-client/core
Advanced tools
Comparing version 0.11.9 to 0.11.10
@@ -6,2 +6,13 @@ # Change Log | ||
## [0.11.10](https://github.com/statsbotco/cubejs-client/compare/v0.11.9...v0.11.10) (2019-10-25) | ||
### Features | ||
* client headers for CubejsApi ([#242](https://github.com/statsbotco/cubejs-client/issues/242)). Thanks to [@ferrants](https://github.com/ferrants)! ([2f75ef3](https://github.com/statsbotco/cubejs-client/commit/2f75ef3)), closes [#241](https://github.com/statsbotco/cubejs-client/issues/241) | ||
## [0.11.9](https://github.com/statsbotco/cubejs-client/compare/v0.11.8...v0.11.9) (2019-10-23) | ||
@@ -8,0 +19,0 @@ |
@@ -743,3 +743,5 @@ import _objectSpread from '@babel/runtime/helpers/objectSpread'; | ||
var authorization = _ref.authorization, | ||
apiUrl = _ref.apiUrl; | ||
apiUrl = _ref.apiUrl, | ||
_ref$headers = _ref.headers, | ||
headers = _ref$headers === void 0 ? {} : _ref$headers; | ||
@@ -750,2 +752,3 @@ _classCallCheck(this, HttpTransport); | ||
this.apiUrl = apiUrl; | ||
this.headers = headers; | ||
} | ||
@@ -766,6 +769,6 @@ | ||
return fetch("".concat(_this.apiUrl, "/").concat(method).concat(searchParams.toString().length ? "?".concat(searchParams) : ''), { | ||
headers: { | ||
headers: Object.assign({ | ||
Authorization: _this.authorization, | ||
'Content-Type': 'application/json' | ||
} | ||
}, _this.headers) | ||
}); | ||
@@ -847,5 +850,7 @@ }; | ||
this.apiUrl = options.apiUrl || API_URL; | ||
this.headers = options.headers || {}; | ||
this.transport = options.transport || new HttpTransport({ | ||
authorization: typeof apiToken === 'function' ? undefined : apiToken, | ||
apiUrl: this.apiUrl | ||
apiUrl: this.apiUrl, | ||
headers: this.headers | ||
}); | ||
@@ -852,0 +857,0 @@ this.pollInterval = options.pollInterval || 5; |
@@ -749,3 +749,5 @@ 'use strict'; | ||
var authorization = _ref.authorization, | ||
apiUrl = _ref.apiUrl; | ||
apiUrl = _ref.apiUrl, | ||
_ref$headers = _ref.headers, | ||
headers = _ref$headers === void 0 ? {} : _ref$headers; | ||
@@ -756,2 +758,3 @@ _classCallCheck(this, HttpTransport); | ||
this.apiUrl = apiUrl; | ||
this.headers = headers; | ||
} | ||
@@ -772,6 +775,6 @@ | ||
return fetch("".concat(_this.apiUrl, "/").concat(method).concat(searchParams.toString().length ? "?".concat(searchParams) : ''), { | ||
headers: { | ||
headers: Object.assign({ | ||
Authorization: _this.authorization, | ||
'Content-Type': 'application/json' | ||
} | ||
}, _this.headers) | ||
}); | ||
@@ -853,5 +856,7 @@ }; | ||
this.apiUrl = options.apiUrl || API_URL; | ||
this.headers = options.headers || {}; | ||
this.transport = options.transport || new HttpTransport({ | ||
authorization: typeof apiToken === 'function' ? undefined : apiToken, | ||
apiUrl: this.apiUrl | ||
apiUrl: this.apiUrl, | ||
headers: this.headers | ||
}); | ||
@@ -858,0 +863,0 @@ this.pollInterval = options.pollInterval || 5; |
{ | ||
"name": "@cubejs-client/core", | ||
"version": "0.11.9", | ||
"version": "0.11.10", | ||
"description": "cube.js client", | ||
@@ -30,3 +30,3 @@ "main": "dist/cubejs-client-core.js", | ||
}, | ||
"gitHead": "693b6fd46c1da37e6cc5050dc5629ae8ee2e5ce6" | ||
"gitHead": "be8533c15ca90c7548999d4e30a284db46e3f35f" | ||
} |
@@ -5,5 +5,6 @@ import fetch from 'cross-fetch'; | ||
class HttpTransport { | ||
constructor({ authorization, apiUrl }) { | ||
constructor({ authorization, apiUrl, headers = {} }) { | ||
this.authorization = authorization; | ||
this.apiUrl = apiUrl; | ||
this.headers = headers | ||
} | ||
@@ -20,3 +21,3 @@ | ||
`${this.apiUrl}/${method}${searchParams.toString().length ? `?${searchParams}` : ''}`, { | ||
headers: { Authorization: this.authorization, 'Content-Type': 'application/json' } | ||
headers: Object.assign({ Authorization: this.authorization, 'Content-Type': 'application/json' }, this.headers) | ||
} | ||
@@ -23,0 +24,0 @@ ); |
@@ -38,5 +38,7 @@ /** | ||
this.apiUrl = options.apiUrl || API_URL; | ||
this.headers = options.headers || {}; | ||
this.transport = options.transport || new HttpTransport({ | ||
authorization: typeof apiToken === 'function' ? undefined : apiToken, | ||
apiUrl: this.apiUrl | ||
apiUrl: this.apiUrl, | ||
headers: this.headers | ||
}); | ||
@@ -43,0 +45,0 @@ this.pollInterval = options.pollInterval || 5; |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
608327
16553