Skip to content

Commit

Permalink
chore: Upgrade axios, as there was a security issue, they fixed the u…
Browse files Browse the repository at this point in the history
…rl behavior
  • Loading branch information
marcbachmann committed Aug 20, 2024
1 parent 80c7e31 commit a037180
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 23 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"axios": ">= 0.17.0"
},
"devDependencies": {
"axios": "^1.7.3",
"axios": "^1.7.4",
"chai": "^4.3.6",
"eslint": "^9.8.0",
"mocha": "^10.7.0",
Expand Down
10 changes: 2 additions & 8 deletions test/pass_through.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const axios = require("axios");
const isLegacyAxios = require("axios/package.json").version[0] === "0";
const expect = require("chai").expect;
const createServer = require("http").createServer;

Expand Down Expand Up @@ -107,7 +106,7 @@ describe("passThrough tests (requires Node)", function () {

it("handles baseURL correctly", function () {
instance = axios.create({
baseURL: "/test",
baseURL: "http://localhost/test",
proxy: {
host: "127.0.0.1",
port: httpServer.address().port,
Expand All @@ -118,12 +117,7 @@ describe("passThrough tests (requires Node)", function () {
mock.onAny().passThrough();
return instance.get("/foo").then(function (response) {
expect(response.status).to.equal(200);

if (isLegacyAxios) {
expect(response.data).to.equal("http://null/test/foo");
} else {
expect(response.data).to.equal("http://localhost/test/foo");
}
expect(response.data).to.equal("http://localhost/test/foo");
});
});

Expand Down
9 changes: 2 additions & 7 deletions test/pass_through_on_no_match.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const axios = require("axios");
const isLegacyAxios = require("axios/package.json").version[0] === "0";
const expect = require("chai").expect;
const createServer = require("http").createServer;

Expand Down Expand Up @@ -113,7 +112,7 @@ describe("onNoMatch=passthrough option tests (requires Node)", function () {

it("handles baseURL correctly", function () {
instance = axios.create({
baseURL: "/test",
baseURL: "http://localhost/test",
proxy: {
host: "127.0.0.1",
port: httpServer.address().port,
Expand All @@ -123,11 +122,7 @@ describe("onNoMatch=passthrough option tests (requires Node)", function () {

return instance.get("/foo").then(function (response) {
expect(response.status).to.equal(200);
if (isLegacyAxios) {
expect(response.data).to.equal("http://null/test/foo");
} else {
expect(response.data).to.equal("http://localhost/test/foo");
}
expect(response.data).to.equal("http://localhost/test/foo");
});
});

Expand Down

0 comments on commit a037180

Please sign in to comment.