@eclipse-che/che-e2e
Advanced tools
Comparing version 7.40.3-dev-0d6b41a to 7.40.3-dev-c00847f
@@ -32,2 +32,3 @@ "use strict"; | ||
const inversify_1 = require("inversify"); | ||
const Logger_1 = require("../Logger"); | ||
let CheApiRequestHandler = class CheApiRequestHandler { | ||
@@ -41,11 +42,19 @@ constructor(headerHandler) { | ||
static enableRequestInteceptor() { | ||
console.log(`CheApiRequestHandler.enableRequestInterceptor`); | ||
Logger_1.Logger.debug(`CheApiRequestHandler.enableRequestInterceptor`); | ||
return axios_1.default.interceptors.request.use(request => { | ||
try { | ||
let request_censored = JSON.parse(JSON.stringify(request)); | ||
if (request_censored === undefined) { | ||
Logger_1.Logger.error('JSON.parse returned an undefined object, cannot process request'); | ||
return request; | ||
} | ||
if (request_censored.headers === undefined) { | ||
Logger_1.Logger.warn('Request does not contain any headers object'); | ||
return request; | ||
} | ||
request_censored.headers.Authorization = 'CENSORED'; | ||
console.log(`RequestHandler request:\n`, request_censored); | ||
Logger_1.Logger.info(`RequestHandler request:\n` + request_censored); | ||
} | ||
catch (err) { | ||
console.log(`RequestHandler request: Failed to deep clone AxiosRequestConfig:`, err); | ||
Logger_1.Logger.error(`RequestHandler request: Failed to deep clone AxiosRequestConfig:` + err); | ||
} | ||
@@ -59,3 +68,3 @@ return request; | ||
static enableResponseInterceptor() { | ||
console.log(`CheApiRequestHandler.enableResponseRedirects`); | ||
Logger_1.Logger.debug(`CheApiRequestHandler.enableResponseRedirects`); | ||
return axios_1.default.interceptors.response.use(response => { | ||
@@ -69,2 +78,14 @@ try { | ||
})); | ||
if (response_censored === undefined) { | ||
Logger_1.Logger.error('JSON.parse returned an undefined object, cannot process response'); | ||
return response; | ||
} | ||
if (response_censored.config === undefined) { | ||
Logger_1.Logger.warn('Response does not contain any config object'); | ||
return response; | ||
} | ||
if (response_censored.config.headers === undefined) { | ||
Logger_1.Logger.warn('Response does not contain any config.headers object'); | ||
return response; | ||
} | ||
response_censored.config.headers.Authorization = 'CENSORED'; | ||
@@ -77,6 +98,6 @@ if (response_censored.data.access_token != null) { | ||
} | ||
console.log(`RequestHandler response:\n`, response_censored); | ||
Logger_1.Logger.info(`RequestHandler response:\n` + response_censored); | ||
} | ||
catch (err) { | ||
console.log(`RequestHandler response: Failed to deep clone AxiosResponse:`, err); | ||
Logger_1.Logger.error(`RequestHandler response: Failed to deep clone AxiosResponse:` + err); | ||
} | ||
@@ -83,0 +104,0 @@ return response; |
{ | ||
"name": "@eclipse-che/che-e2e", | ||
"version": "7.40.3-dev-0d6b41a", | ||
"version": "7.40.3-dev-c00847f", | ||
"description": "", | ||
@@ -40,3 +40,3 @@ "main": "dist/index.js", | ||
"@types/selenium-webdriver": "3.0.16", | ||
"axios": "0.21.2", | ||
"axios": "^0.25.0", | ||
"chai": "4.2.0", | ||
@@ -53,3 +53,3 @@ "chromedriver": "95.0.0", | ||
"dependencies": { | ||
"@eclipse-che/api": "latest", | ||
"@eclipse-che/api": "7.40.1", | ||
"inversify": "5.0.1", | ||
@@ -56,0 +56,0 @@ "reflect-metadata": "0.1.13" |
@@ -16,2 +16,3 @@ /********************************************************************* | ||
import { IAuthorizationHeaderHandler } from './headers/IAuthorizationHeaderHandler'; | ||
import { Logger } from '../Logger'; | ||
@@ -25,10 +26,18 @@ @injectable() | ||
public static enableRequestInteceptor(): number { | ||
console.log(`CheApiRequestHandler.enableRequestInterceptor`); | ||
Logger.debug(`CheApiRequestHandler.enableRequestInterceptor`); | ||
return axios.interceptors.request.use( request => { | ||
try { | ||
let request_censored: AxiosRequestConfig = JSON.parse(JSON.stringify(request)); | ||
if (request_censored === undefined) { | ||
Logger.error('JSON.parse returned an undefined object, cannot process request'); | ||
return request; | ||
} | ||
if (request_censored.headers === undefined) { | ||
Logger.warn('Request does not contain any headers object'); | ||
return request; | ||
} | ||
request_censored.headers.Authorization = 'CENSORED'; | ||
console.log(`RequestHandler request:\n`, request_censored); | ||
Logger.info(`RequestHandler request:\n` + request_censored); | ||
} catch (err) { | ||
console.log(`RequestHandler request: Failed to deep clone AxiosRequestConfig:`, err); | ||
Logger.error(`RequestHandler request: Failed to deep clone AxiosRequestConfig:` + err); | ||
} | ||
@@ -43,3 +52,3 @@ return request; | ||
public static enableResponseInterceptor(): number { | ||
console.log(`CheApiRequestHandler.enableResponseRedirects`); | ||
Logger.debug(`CheApiRequestHandler.enableResponseRedirects`); | ||
return axios.interceptors.response.use( response => { | ||
@@ -53,2 +62,14 @@ try { | ||
})); | ||
if (response_censored === undefined) { | ||
Logger.error('JSON.parse returned an undefined object, cannot process response'); | ||
return response; | ||
} | ||
if (response_censored.config === undefined) { | ||
Logger.warn('Response does not contain any config object'); | ||
return response; | ||
} | ||
if (response_censored.config.headers === undefined) { | ||
Logger.warn('Response does not contain any config.headers object'); | ||
return response; | ||
} | ||
response_censored.config.headers.Authorization = 'CENSORED'; | ||
@@ -61,5 +82,5 @@ if (response_censored.data.access_token != null) { | ||
} | ||
console.log(`RequestHandler response:\n`, response_censored); | ||
Logger.info(`RequestHandler response:\n` + response_censored); | ||
} catch (err) { | ||
console.log(`RequestHandler response: Failed to deep clone AxiosResponse:`, err); | ||
Logger.error(`RequestHandler response: Failed to deep clone AxiosResponse:` + err); | ||
} | ||
@@ -66,0 +87,0 @@ return response; |
Sorry, the diff of this file is not supported yet
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
1512835
20496
+ Added@eclipse-che/api@7.40.1(transitive)
- Removed@eclipse-che/api@7.98.0(transitive)
Updated@eclipse-che/api@7.40.1