Skip to content

Commit

Permalink
fix(rest): updated Axios to 0.27.2
Browse files Browse the repository at this point in the history
Related axios/axios#4124

closes #1223
  • Loading branch information
jan-molak committed Jun 11, 2022
1 parent 3113f20 commit b54694b
Show file tree
Hide file tree
Showing 10 changed files with 183 additions and 382 deletions.
535 changes: 167 additions & 368 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"devDependencies": {
"@types/chai": "^4.3.1",
"@types/chai-as-promised": "^7.1.5",
"@types/node": "^14.18.16",
"@types/node": "^14.18.21",
"@types/sinon": "^10.0.11",
"@types/sinon-chai": "^3.2.8",
"@typescript-eslint/eslint-plugin": "^5.27.0",
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/model/artifacts/HTTPRequestResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ export interface RequestAndResponse extends JSONObject {
request: {
url: string;
method: string;
headers: { [header: string]: string };
headers: Record<string, string | number | boolean>;
data?: any;
};
response: {
status: number;
data?: any;
headers?: { [header: string]: string };
headers?: Record<string, string> & {
'set-cookie'?: string[]
};
};
}

Expand Down
2 changes: 1 addition & 1 deletion packages/local-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"@types/hapi": "^18.0.7",
"@types/mocha": "^9.1.1",
"@types/restify": "^8.5.4",
"axios": "^0.21.4",
"axios": "^0.27.2",
"express": "^4.18.1",
"koa": "^2.13.4",
"mocha": "^10.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/protractor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"@types/html-minifier": "^4.0.2",
"@types/mocha": "^9.1.1",
"@types/selenium-webdriver": "^3.0.19",
"axios": "^0.21.4",
"axios": "^0.27.2",
"body-parser": "^1.20.0",
"cross-env": "^7.0.3",
"express": "^4.18.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/rest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
},
"dependencies": {
"@serenity-js/core": "3.0.0-rc.18",
"axios": "^0.21.4"
"axios": "^0.27.2"
},
"devDependencies": {
"@documentation/esdoc-template": "3.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/rest/src/screenplay/abilities/CallAnApi.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Ability, ConfigurationError, LogicError, TestCompromisedError, UsesAbilities } from '@serenity-js/core';
import axios, { AxiosError, AxiosInstance, AxiosPromise, AxiosRequestConfig, AxiosResponse } from 'axios';
import axios, { AxiosDefaults, AxiosError, AxiosInstance, AxiosPromise, AxiosRequestConfig, AxiosResponse } from 'axios';
const mergeConfig = require('axios/lib/core/mergeConfig'); // eslint-disable-line @typescript-eslint/no-var-requires
const buildFullPath = require('axios/lib/core/buildFullPath'); // eslint-disable-line @typescript-eslint/no-var-requires

Expand Down Expand Up @@ -126,7 +126,7 @@ export class CallAnApi implements Ability {
*
* @see {@link AxiosRequestConfig}
*/
modifyConfig(fn: (original: AxiosRequestConfig) => any): void {
modifyConfig(fn: (original: AxiosDefaults<any>) => any): void {
fn(this.axiosInstance.defaults);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/serenity-bdd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"@serenity-js/assertions": "3.0.0-rc.18",
"@serenity-js/core": "3.0.0-rc.18",
"@serenity-js/rest": "3.0.0-rc.18",
"axios": "^0.21.4",
"axios": "^0.27.2",
"chalk": "^4.1.2",
"find-java-home": "^1.2.2",
"https-proxy-agent": "^5.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function activityRelatedArtifact<Context extends SerenityBDDReportContext
.else(_ => report)
}

function mapToString(dictionary: {[key: string]: string}) {
function mapToString(dictionary: Record<string, string | number | boolean>) {
return Object.keys(dictionary).map(key => `${key}: ${dictionary[key]}`).join('\n');
}

Expand Down Expand Up @@ -88,9 +88,9 @@ function httpRequestResponse<Context extends SerenityBDDReportContext>(activityI
method: requestResponse.request.method.toUpperCase(),
path: requestResponse.request.url,
content: bodyToString(requestResponse.request.data),
contentType: requestResponse.request.headers['Content-Type'] || '', // todo: add a case insensitive proxy around this RFC 2616: 4.2
requestHeaders: mapToString(requestResponse.request.headers) || '',
requestCookies: requestResponse.request.headers.Cookie || '', // todo: add a case insensitive proxy around this RFC 2616: 4.2
contentType: String(requestResponse.request.headers['Content-Type'] || ''), // todo: add a case insensitive proxy around this RFC 2616: 4.2
requestHeaders: mapToString(requestResponse.request.headers || {}) || '',
requestCookies: String(requestResponse.request.headers.Cookie || ''), // todo: add a case insensitive proxy around this RFC 2616: 4.2
statusCode: requestResponse.response.status,
responseHeaders: mapToString(requestResponse.response.headers) || '',
responseCookies: requestResponse.response.headers.Cookie || '', // todo: add a case insensitive proxy around this RFC 2616: 4.2
Expand Down
2 changes: 1 addition & 1 deletion packages/webdriverio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"@wdio/local-runner": "^7.19.7",
"@wdio/mocha-framework": "^7.19.7",
"@wdio/spec-reporter": "^7.19.7",
"axios": "^0.21.4",
"axios": "^0.27.2",
"cross-env": "^7.0.3",
"mocha": "^10.0.0",
"mocha-testdata": "^1.2.0",
Expand Down

0 comments on commit b54694b

Please sign in to comment.