@sap-ux/axios-extension
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -147,3 +147,3 @@ "use strict"; | ||
const oneTimeRespInterceptorId = provider.interceptors.response.use((response) => { | ||
var _a, _b, _c, _d; | ||
var _a, _b, _c; | ||
if (response.status === 401) { | ||
@@ -163,12 +163,2 @@ throw new error_1.ConnectionError(response.statusText, response); | ||
if ((_c = response.headers) === null || _c === void 0 ? void 0 : _c[CSRF.ResponseHeaderName]) { | ||
provider.defaults.headers = (_d = provider.defaults.headers) !== null && _d !== void 0 ? _d : { | ||
common: {}, | ||
// eslint-disable-next-line quote-props | ||
delete: {}, | ||
put: {}, | ||
get: {}, | ||
post: {}, | ||
head: {}, | ||
patch: {} | ||
}; | ||
provider.defaults.headers.common[CSRF.RequestHeaderName] = | ||
@@ -175,0 +165,0 @@ response.headers[CSRF.ResponseHeaderName]; |
@@ -30,3 +30,3 @@ "use strict"; | ||
function createInstance(ProviderType, config) { | ||
var _a; | ||
var _a, _b; | ||
const providerConfig = lodash_clonedeep_1.default(config); | ||
@@ -39,4 +39,14 @@ providerConfig.httpsAgent = new https_1.Agent({ | ||
const instance = new ProviderType(providerConfig); | ||
instance.defaults.headers = (_a = instance.defaults.headers) !== null && _a !== void 0 ? _a : { | ||
common: {}, | ||
// eslint-disable-next-line quote-props | ||
delete: {}, | ||
put: {}, | ||
get: {}, | ||
post: {}, | ||
head: {}, | ||
patch: {} | ||
}; | ||
auth_1.attachConnectionHandler(instance); | ||
if ((_a = providerConfig.auth) === null || _a === void 0 ? void 0 : _a.password) { | ||
if ((_b = providerConfig.auth) === null || _b === void 0 ? void 0 : _b.password) { | ||
auth_1.attachBasicAuthInterceptor(instance); | ||
@@ -113,5 +123,4 @@ } | ||
const oneTimeReqInterceptorId = provider.interceptors.request.use((request) => __awaiter(this, void 0, void 0, function* () { | ||
const url = new URL(provider.defaults.baseURL); | ||
url.username = yield btp_utils_1.getUserForDestinationService(destinationServiceInstance); | ||
request.baseURL = provider.defaults.baseURL = url.toString(); | ||
const credentials = yield btp_utils_1.getCredentialsForDestinationService(destinationServiceInstance); | ||
provider.defaults.headers.common[btp_utils_1.BAS_DEST_INSTANCE_CRED_HEADER] = credentials; | ||
provider.interceptors.request.eject(oneTimeReqInterceptorId); | ||
@@ -118,0 +127,0 @@ return request; |
{ | ||
"name": "@sap-ux/axios-extension", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "Extension of the Axios module adding convinience methods to interact with SAP systems especially with OData services.", | ||
@@ -17,3 +17,3 @@ "repository": { | ||
"dependencies": { | ||
"@sap-ux/btp-utils": "0.9.0", | ||
"@sap-ux/btp-utils": "0.9.1", | ||
"@sap-ux/logger": "0.1.5", | ||
@@ -20,0 +20,0 @@ "axios": "0.24.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
197462
2993
+ Added@sap-ux/btp-utils@0.9.1(transitive)
- Removed@sap-ux/btp-utils@0.9.0(transitive)
Updated@sap-ux/btp-utils@0.9.1