status
stringclasses 1
value | repo_name
stringclasses 13
values | repo_url
stringclasses 13
values | issue_id
int64 1
104k
| updated_files
stringlengths 11
1.76k
| title
stringlengths 4
369
| body
stringlengths 0
254k
⌀ | issue_url
stringlengths 38
55
| pull_url
stringlengths 38
53
| before_fix_sha
stringlengths 40
40
| after_fix_sha
stringlengths 40
40
| report_datetime
unknown | language
stringclasses 5
values | commit_datetime
unknown |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
closed | axios/axios | https://github.com/axios/axios | 4,727 | [".github/workflows/ci.yml", "bin/ssl_hotfix.js", "lib/helpers/fromDataURI.js", "lib/helpers/toFormData.js", "package-lock.json", "package.json", "test/unit/adapters/http.js", "test/unit/helpers/fromDataURI.js"] | postForm fails with "source.on is not a function" when using Buffer or Uint8Array in Node 18 | <!-- Click "Preview" for a more readable version --
Please read and follow the instructions before submitting an issue:
- Read all our documentation, especially the [README](https://github.com/axios/axios/blob/master/README.md). It may contain information that helps you solve your issue.
- Ensure your issue isn't already [reported](https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=is%3Aissue).
- If you aren't sure that the issue is caused by Axios or you just need help, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/axios) or [our chat](https://gitter.im/mzabriskie/axios).
- If you're reporting a bug, ensure it isn't already fixed in the latest Axios version.
- Don't remove any title of the issue template, or it will be treated as invalid by the bot.
⚠️👆 Feel free to these instructions before submitting the issue 👆⚠️
-->
#### Describe the issue
Passing Uint8Array or Buffer to postForm results in "source.on is not a function" exception.
#### Example Code
```js
const data = Uint8Array.from([1, 2, 3])
axios.postForm('http://some.url', { data })
// or
const data = Uint8Array.from([1, 2, 3])
axios.postForm('http://some.url', { data: Buffer.from(data) })
```
#### Expected behavior, if applicable
axios should POST a field "data" with the content of the Uint8Array / Buffer
#### Environment
- Axios Version 0.27.2
- Node.js Version 18.2.0
- OS: Windows 11
#### Additional context/Screenshots
Code is compiled from TypeScript using typescript 4.6.4 and a tsconfig.json that extends @tsconfig/node18/tsconfig.json
I am trying to upload the PDF output of puppeteer.
What am I doing wrong? | https://github.com/axios/axios/issues/4727 | https://github.com/axios/axios/pull/4728 | de973f00f312080fb0dd0dc3b9cbe72c88b3da61 | 467025bdb743d0132ee236a7c935b9ac14f5408f | "2022-05-18T15:22:55Z" | javascript | "2022-05-20T14:31:26Z" |
closed | axios/axios | https://github.com/axios/axios | 4,713 | ["lib/core/AxiosError.js"] | AxiosError does not include stack trace (`stack` property) | Version 0.26.1 of axios created errors by calling `new Error()`, and then augmenting it. Doing it this way, the error object contained a `stack` property with the stack trace.
With version 0.27, axios creates errors as an Object, and doesn't add the `stack` property to them, so there's no stack trace available.
Expected behavior is that there will be a `stack` property with a stack trace.
The issue is that the constructor for `AxiosError` does `Error.call(this);`, but that doesn't add a stack trace property. Adding the stack trace needs to be done after that using code like:
```
// Use V8's native method if available, otherwise fallback
if ("captureStackTrace" in Error)
Error.captureStackTrace(this, InvalidArgumentException);
else
this.stack = (new Error()).stack;
```
See my stack overflow article https://stackoverflow.com/questions/464359/custom-exception-type/27724419#27724419 for more info.
I can submit a PR if you guys agree on the technique.
Thanks! | https://github.com/axios/axios/issues/4713 | https://github.com/axios/axios/pull/4718 | 65b92958ae4f4838646797d1468b86990bd49e83 | d60d6844b15204a87c96ad289cb502a9647ed6cc | "2022-05-13T20:41:25Z" | javascript | "2022-05-16T06:58:47Z" |
closed | axios/axios | https://github.com/axios/axios | 4,684 | ["index.d.ts"] | AxiosError has status defined as string but it is really number | <!-- Click "Preview" for a more readable version --
Please read and follow the instructions before submitting an issue:
- Read all our documentation, especially the [README](https://github.com/axios/axios/blob/master/README.md). It may contain information that helps you solve your issue.
- Ensure your issue isn't already [reported](https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=is%3Aissue).
- If you aren't sure that the issue is caused by Axios or you just need help, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/axios) or [our chat](https://gitter.im/mzabriskie/axios).
- If you're reporting a bug, ensure it isn't already fixed in the latest Axios version.
- Don't remove any title of the issue template, or it will be treated as invalid by the bot.
⚠️👆 Feel free to these instructions before submitting the issue 👆⚠️
-->
#### Describe the bug
Type definition for AxiosError is incorrect. The definition was introduced in this commit:
https://github.com/axios/axios/pull/3645/files#diff-7aa4473ede4abd9ec099e87fec67fd57afafaf39e05d493ab4533acc38547eb8R137
When you look at the actual runtime payload it has a number type. For example, a 401 error has `status` of `401` not `"401"` when you `JSON.stringify(error)`.
#### To Reproduce
A code snippet really doesn't make sense here, but you can see the JSON object that was constructed from the error object in the case that I observed.
```json
{
"message": "Request failed with status code 401",
"name": "AxiosError",
"config": {
"transitional": {
"silentJSONParsing": true,
"forcedJSONParsing": true,
"clarifyTimeoutError": false
},
"transformRequest": [null],
"transformResponse": [null],
"timeout": 0,
"xsrfCookieName": "XSRF-TOKEN",
"xsrfHeaderName": "X-XSRF-TOKEN",
"maxContentLength": -1,
"maxBodyLength": -1,
"env": {},
"headers": {
"Accept": "application/json",
"Cache-Control": "no-cache",
"Content-Type": "no-cache",
"User-Agent": "axios/0.27.2"
},
"method": "get",
"url": "https://somedomainrequiringauth.com/some-endpoint-requiring-auth"
},
"code": "ERR_BAD_REQUEST",
"status": 401
}
```
#### Expected behavior
The definition should be a number.
#### Environment
- Axios Version 0.27.2
- Adapter HTTP
- Browser N/A
- Browser Version N/A
- Node.js Version v16.14.2
- OS: OSX 12.2.1
- Additional Library Versions N/A
#### Additional context/Screenshots
N/A | https://github.com/axios/axios/issues/4684 | https://github.com/axios/axios/pull/4717 | 9be61dc1c9a84085a0a2ac80500034aa9418d57c | 65b92958ae4f4838646797d1468b86990bd49e83 | "2022-05-06T01:07:48Z" | javascript | "2022-05-16T06:51:22Z" |
closed | axios/axios | https://github.com/axios/axios | 4,677 | ["lib/adapters/xhr.js"] | blob: urls rejected | #### Describe the bug
axios throws ERR_BAD_REQUEST (message: Unsupported protocol blob:) when processing a url with scheme blob:
#### To Reproduce
This code:
```js
const blob = new Blob(["some content"]);
const url = URL.createObjectURL(blob);
const response = await axios.get(url, {responseType: "blob"});
```
generates a blob url (eg, blob:http://localhost:3001/01296a6c-a41f-49b1-b59e-af71729dbb6b) which axios rejects as having an invalid scheme. But the browser supports such urls and it was working alright until https://github.com/axios/axios/pull/3544 which started restricting the schemes accepted.
#### Expected behavior
Accept the request.
#### Environment
- Browser
- axios 0.26.1 and later.
#### Additional context/Screenshots
Add any other context about the problem here. If applicable, add screenshots to help explain.
| https://github.com/axios/axios/issues/4677 | https://github.com/axios/axios/pull/4678 | 2f50c8249bba77a34eb7d14e3274ed560c2f2e91 | 356b166182de33936c8581df1637894f06d9f386 | "2022-05-05T03:25:28Z" | javascript | "2022-05-09T17:27:18Z" |
closed | axios/axios | https://github.com/axios/axios | 4,633 | ["lib/adapters/xhr.js", "lib/helpers/parseProtocol.js", "test/unit/helpers/parseProtocol.js"] | Unexpected 'Unsupported protocol' error for relative URLs containing colon (:) character | #### Describe the bug
For some REST API endpoints we use [Google Cloud API Custom Methods](https://cloud.google.com/apis/design/custom_methods) URL design like `/api/resource:customVerb`.
These worked with `axios` prior to **0.27.1** but now they result in an error like:
`AxiosError { message: "Unsupported protocol /api/resource:', code: "ERR_BAD_REQUEST", ... }`
#### To Reproduce
Try to have `axios` get a relative URL with a colon in it, e.g.
```js
axios.get("/api/resource:customVerb");
```
#### Expected behavior
Should continue working as it did before version **0.27.1**.
#### Environment
- Axios Version: 0.27.1
- Browser: Microsoft Edge 100.0.1185.50
- Node.js Version: 16.14.2
- OS: Windows 10 Pro
#### Additional context/Screenshots
n/a
| https://github.com/axios/axios/issues/4633 | https://github.com/axios/axios/pull/4639 | 76432c18bee20e2cbd9e673af8a3bf43641ad115 | b9e9fb4fa0ab1e0f4bc9ac8d8cf493f5f8507dc3 | "2022-04-26T12:55:07Z" | javascript | "2022-04-27T09:30:50Z" |
closed | axios/axios | https://github.com/axios/axios | 4,623 | ["lib/adapters/http.js"] | axios v0.27.0 uses node polyfills provided by webpack, which are removed from webpack v5 | <!-- Click "Preview" for a more readable version --
Please read and follow the instructions before submitting an issue:
- Read all our documentation, especially the [README](https://github.com/axios/axios/blob/master/README.md). It may contain information that helps you solve your issue.
- Ensure your issue isn't already [reported](https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=is%3Aissue).
- If you aren't sure that the issue is caused by Axios or you just need help, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/axios) or [our chat](https://gitter.im/mzabriskie/axios).
- If you're reporting a bug, ensure it isn't already fixed in the latest Axios version.
- Don't remove any title of the issue template, or it will be treated as invalid by the bot.
⚠️👆 Feel free to these instructions before submitting the issue 👆⚠️
-->
#### Describe the bug
I'm using axios in an app created by create-react-app. As soon I upgraded axios to v0.27.0, the application stop working with the error shown in the reproduction section. Downgrading to v0.26.1 solved the issue.
It looks like the issues rises from the xhr adapter.
#### To Reproduce
Create an empty project using CRA
```shell
npx create-react-app my-app
cd my-app
```
install axios
```shell
npm install axios
```
use axios to make any request
```js
useEffect(() => {
axios.get("https://google.com");
}, []);
```
start the application
```shell
npm start
```
The error is shown in the console
```shell
Module not found: Error: Can't resolve 'url' in '/home/mayo/personal-projects/my-app/node_modules/axios/lib/adapters'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "url": require.resolve("url/") }'
- install 'url'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "url": false }
ERROR in ./node_modules/axios/lib/adapters/xhr.js 17:10-24
Module not found: Error: Can't resolve 'url' in '/home/mayo/personal-projects/my-app/node_modules/axios/lib/adapters'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "url": require.resolve("url/") }'
- install 'url'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "url": false }
webpack compiled with 1 error
```
#### Expected behavior
That it works, or at least there are instruction to install the dependencies in the documentation.
#### Environment
- Axios Version 0.27.0
- Additional Library Versions create-react-app (react-scripts) v5 / webpack v5
#### Additional context/Screenshots
None | https://github.com/axios/axios/issues/4623 | https://github.com/axios/axios/pull/4715 | c05ad4895293ac8e0bbb90b28e0772571a97cdd5 | 9be61dc1c9a84085a0a2ac80500034aa9418d57c | "2022-04-25T19:14:11Z" | javascript | "2022-05-16T06:46:46Z" |
closed | axios/axios | https://github.com/axios/axios | 4,616 | ["lib/core/dispatchRequest.js", "test/specs/transform.spec.js"] | content-type application/x-www-form-urlencoded repeated | <!-- Click "Preview" for a more readable version --
Please read and follow the instructions before submitting an issue:
- Read all our documentation, especially the [README](https://github.com/axios/axios/blob/master/README.md). It may contain information that helps you solve your issue.
- Ensure your issue isn't already [reported](https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=is%3Aissue).
- If you aren't sure that the issue is caused by Axios or you just need help, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/axios) or [our chat](https://gitter.im/mzabriskie/axios).
- If you're reporting a bug, ensure it isn't already fixed in the latest Axios version.
- Don't remove any title of the issue template, or it will be treated as invalid by the bot.
⚠️👆 Feel free to these instructions before submitting the issue 👆⚠️
-->
#### Describe the bug
when 'content-type' is in lowercase,
Devtool Network show :Content-Type: application/x-www-form-urlencoded, application/x-www-form-urlencoded,
that is repeated.
#### To Reproduce
Code snippet to reproduce, ideally that will work by pasting into something like https://npm.runkit.com/axios, a hosted solution, or a repository that illustrates the issue. **If your problem is not reproducible, please file under Support or Usage Question**
```js
axios({
method: 'post',
url: 'http://yapi.corp.lanyicj.cn/mock/228/stock_trade/user_account',
headers: { 'content-type': 'application/x-www-form-urlencoded' },
transformRequest: [
function () {
return 'aa=44'
}
]
})
```
#### Expected behavior
Content-Type: application/x-www-form-urlencoded
#### Environment
- Axios Version [e.g. 0.18.0]
- Adapter [e.g. XHR/HTTP]
- Browser [e.g. Chrome, Safari]
- Browser Version [e.g. 22]
- Node.js Version [e.g. 13.0.1]
- OS: [e.g. iOS 12.1.0, OSX 10.13.4]
- Additional Library Versions [e.g. React 16.7, React Native 0.58.0]
#### Additional context/Screenshots
Add any other context about the problem here. If applicable, add screenshots to help explain.
| https://github.com/axios/axios/issues/4616 | https://github.com/axios/axios/pull/4745 | a11f9501b823a167de7187ee542e4204ad1a517a | 1504792765a89bfe5b07041979a86218cace9c6d | "2022-04-25T11:56:30Z" | javascript | "2022-05-28T09:52:50Z" |
closed | axios/axios | https://github.com/axios/axios | 4,486 | ["lib/core/AxiosError.js", "lib/utils.js", "test/unit/utils/utils.js"] | Error.toJSON() should exclude httpsAgent | #### Describe the bug
if the `httpsAgent` property is set, it is not excluded from `error.toJSON()` resulting in a circular reference error
```none
TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Object'
| property 'httpsAgent' -> object with constructor 'Agent'
| property 'sockets' -> object with constructor 'Object'
| ...
| property 'errored' -> object with constructor 'Object'
--- property 'config' closes the circle
at JSON.stringify (<anonymous>)
```
#### To Reproduce
```js
const agent = new https.Agent({
rejectUnauthorized: false
});
axios.get("some-dodgy-url", {
httpsAgent: agent
}).catch((err) => {
console.error(err.toJSON())
})
```
#### Expected behavior
The error object should be serialisable as JSON without throwing circular reference errors.
#### Environment
- Axios 0.26.0
#### Additional context/Screenshots
See [this StackOverflow post](https://stackoverflow.com/q/71150003/283366) | https://github.com/axios/axios/issues/4486 | https://github.com/axios/axios/pull/5247 | a372b4ce4b8027faf1856b3a2a558ce582965864 | b7ee49f63731a914a62bec5768af4b67b7a3f841 | "2022-02-17T01:59:39Z" | javascript | "2022-11-22T18:44:24Z" |
closed | axios/axios | https://github.com/axios/axios | 4,406 | ["index.d.ts", "lib/adapters/http.js", "lib/defaults.js", "lib/helpers/toFormData.js", "lib/utils.js", "test/specs/helpers/toFormData.spec.js"] | Can't post FormData since Axios 0.25.0 | <!-- Click "Preview" for a more readable version --
Please read and follow the instructions before submitting an issue:
- Read all our documentation, especially the [README](https://github.com/axios/axios/blob/master/README.md). It may contain information that helps you solve your issue.
- Ensure your issue isn't already [reported](https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=is%3Aissue).
- If you aren't sure that the issue is caused by Axios or you just need help, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/axios) or [our chat](https://gitter.im/mzabriskie/axios).
- If you're reporting a bug, ensure it isn't already fixed in the latest Axios version.
- Don't remove any title of the issue template, or it will be treated as invalid by the bot.
⚠️👆 Feel free to these instructions before submitting the issue 👆⚠️
-->
#### Describe the issue
I can't post FormData since `"axios": "^0.25.0",`
`Error: Request failed with status code 400`
#### Example Code
```js
export const client = axios.create({
baseURL: URL_API,
withCredentials: true,
responseType: 'json',
timeout: 30000,
});
const params = new FormData();
params.append('name', data.model);
params.append('idFuel', data.idFuel);
params.append('power', data.idPower);
client.post(`/app/society/${idSociety}/vehicle`, params, { headers: { "Content-Type": "multipart/form-data" } })
```
#### Expected behavior, if applicable
That it works
#### Environment
- Axios Version: 0.25.0
- Node.js Version: v14.17.6
- OS: iOS 15, Android 11 (But on all platforms and versions)
- Additional Library Versions: React Native 0.64.3
#### Additional context/Screenshots
No problem with `"axios": "^0.24.0",`
I saw this PR https://github.com/axios/axios/pull/3757 on 0.25.0, but I don't know what I have to change in code.
Thanks for your help 👍
| https://github.com/axios/axios/issues/4406 | https://github.com/axios/axios/pull/4413 | cc86c6c49fdbfd8e2517b191b8833d2f2816ff91 | 73e3bdb8835ba942096b662e9441f1d85ce4d484 | "2022-01-19T13:36:37Z" | javascript | "2022-02-02T11:48:44Z" |
closed | axios/axios | https://github.com/axios/axios | 4,335 | ["index.d.ts"] | Incomplete typings for AxiosRequestHeaders | #### Describe the bug
`AxiosRequestHeaders` is currently only a `Record` for primitives `Record<string, string | number | boolean>` and, according to typing cannot have object as values. In reality, headers under keys can objects with other keys. A good example is from README:
```
axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
```
#### To Reproduce
F.e. if we were to delete a header entry in `transformRequest` we would get a typescript error `Property 'Authorization' does not exist on type 'string'.`
```js
return axios({
method : 'get',
transformRequest: (data, headers) => {
delete headers?.common?.Authorization;
}
})
```
#### Expected behavior
To be able to access / delete headers under the whole list of keys common, post, etc
#### Environment
- Axios Version 0.24.0
- Adapter HTTP
#### Additional context/Screenshots
This is a typescript bug
| https://github.com/axios/axios/issues/4335 | https://github.com/axios/axios/pull/4334 | ee51e6814320700da03eb8ed62231e31c2557b1e | e6f9026d51d5e1386bc6935e563d95c375c45d02 | "2021-12-17T10:48:22Z" | javascript | "2022-05-16T07:33:36Z" |
closed | axios/axios | https://github.com/axios/axios | 4,263 | ["lib/adapters/http.js", "test/unit/adapters/http.js"] | Unexpected default `maxBodyLength` enforcement by `follow-redirects` | #### Describe the bug
As part of the upgrade of `follow-redirects` in https://github.com/axios/axios/pull/2689, a default `maxBodyLength` of 10MB began to be enforced (previously, there was no request payload limit). There are a few issues with this:
1. The default limit is not mentioned in the `axios` documentation
2. This change in defaults is not included as a breaking change in the `axios` changelog
3. The default is unlimited when `maxRedirects = 0`
#### To Reproduce
```js
axios.post('/size', 'x'.repeat(1e8))
// -> Error: Request body larger than maxBodyLength limit
axios.post('/size', 'x'.repeat(1e8), { maxBodyLength: -1 })
// -> Error: Request body larger than maxBodyLength limit
axios.post('/size', 'x'.repeat(1e8), { maxRedirects: 0 })
// -> OK
axios.post('/size', 'x'.repeat(1e8), { maxBodyLength: Infinity })
// -> OK
```
#### Expected behavior
The default `maxBodyLength` should be consistent and documented, regardless of the value of `maxRedirects`.
#### Environment
- Axios Version: 0.24.0
- Adapter: HTTP
- Browser: N/A
- Browser Version: N/A
- Node.js Version: 16.13.0
- OS: OS X 11.6
- Additional Library Versions: N/A
#### Additional context/Screenshots
This is related to https://github.com/axios/axios/pull/3786, although I don't think that PR goes far enough to correct the inconsistent behavior. | https://github.com/axios/axios/issues/4263 | https://github.com/axios/axios/pull/4731 | c30252f685e8f4326722de84923fcbc8cf557f06 | e9c9f3392b4a31e24b2bcb8399639de624a24386 | "2021-11-13T02:23:41Z" | javascript | "2022-05-20T06:27:37Z" |
closed | axios/axios | https://github.com/axios/axios | 4,260 | ["lib/cancel/CancelToken.js", "test/unit/adapters/http.js"] | Race condition on immediate requests cancellation (a solution is suggested) | #### Describe the bug
Axios throws an error instead of canceling all requests when I try to cancel multiple requests just after sending them.

#### To Reproduce
[Code snippet to reproduce on npm.runkit.com](https://runkit.com/korniychuk/618e792c131c100008191c5e)
```js
var axios = require("axios");
const CancelToken = axios.CancelToken;
const source = CancelToken.source();
const promises = Array(5).fill(1).map((v, i) =>
axios.get('https://www.google.com', { cancelToken: source.token })
.catch(e => axios.isCancel(e) && console.log(`Req ${ i } is cancelled ${ e && e.message }`))
);
source.cancel('Aborted by user');
await Promise.all(promises);
console.log('Done');
```
#### Expected behavior
Should cancel all requests without throwing an error.
#### Environment
- Axios Version [0.24.0]
- Adapter [default maybe, I don't know]
- Browser [NA]
- Browser Version [NA]
- Node.js Version [16.13]
- OS: [*]
- Additional Library Versions [no libraries]
#### Additional context/Screenshots
I've described the issue with the screenshot.

#### Solution
<img width="1238" alt="Ankor 2021-11-12 at 16 43 30@2x" src="https://user-images.githubusercontent.com/11693557/141485034-667c62cf-5084-4c27-812b-9108e3c1d8cb.png">
```js
this.promise.then(function(cancel) {
if (!token._listeners) return;
var i;
var l = token._listeners.length;
/** We have to clone it to avoid a race condition with .unsubscribe() method */
var clonedListenersArr = token._listeners.concat();
for (i = 0; i < l; i++) {
clonedListenersArr[i](cancel);
}
token._listeners = null;
});
```
Maybe someone has time to create a simple PR. It would be great. | https://github.com/axios/axios/issues/4260 | https://github.com/axios/axios/pull/4261 | 27280ec260bb353b57807ebcf8aa30b772663405 | de48c5d626e056d5e6056099c881b878103fc20e | "2021-11-12T14:44:46Z" | javascript | "2022-05-09T16:12:29Z" |
closed | axios/axios | https://github.com/axios/axios | 4,223 | ["index.d.ts"] | unable to set response type on instance method | #### Describe the bug
When configuring the request method through the config object and using the axios instance method, we cannot define the response type returned by the request.
#### To Reproduce
In version `0.22` I used the following code:
```typescript
import axios, { AxiosRequestConfig, AxiosResponse } from 'axios';
const config: AxiosRequestConfig = {
method: 'get',
url: 'https://api.github.com/users/jelleschutter/repos?per_page=1'
}
type RepositoryModel = {
full_name: string;
description: string;
}
axios(config).then((res: AxiosResponse<RepositoryModel[]>) => {
console.log(res.data);
});
```
Which leads to the following error in `0.23`:
```
TS2345: Argument of type '(res: AxiosResponse<RepositoryModel[]>) => void' is not assignable to parameter of type '(value: AxiosResponse<unknown, any>) => void | PromiseLike<void>'.
Types of parameters 'res' and 'value' are incompatible.
Type 'AxiosResponse<unknown, any>' is not assignable to type 'AxiosResponse<Repository[], any>'.
Type 'unknown' is not assignable to type 'Repository[]'.
14 |
> 15 | axios(config).then((res: AxiosResponse<RepositoryModel[]>) => {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16 | console.log(res.data);
17 | });
```
#### Expected behavior
This issue was resolved in `0.24` however the type can still not be explicitly set like in this example:
```typescript
import axios, { AxiosRequestConfig, AxiosResponse } from 'axios';
const config: AxiosRequestConfig = {
method: 'get',
url: 'https://api.github.com/users/jelleschutter/repos?per_page=1'
}
type RepositoryModel = {
full_name: string;
description: string;
}
axios<RepositoryModel[]>(config).then(res => {
console.log(res.data);
});
```
#### Environment
- Axios Version: 0.23.0
- Node.js Version: 14.15.4
- OS: Windows 10
#### Additional context/Screenshots
\- | https://github.com/axios/axios/issues/4223 | https://github.com/axios/axios/pull/4224 | d60d6844b15204a87c96ad289cb502a9647ed6cc | ed0ba0fd60e43cdf80b18aee767a9946acda6705 | "2021-10-27T14:21:17Z" | javascript | "2022-05-16T07:08:02Z" |
closed | axios/axios | https://github.com/axios/axios | 4,157 | ["Gruntfile.js", "index.d.ts", "package.json", "test/typescript/axios.ts", "tsconfig.json", "tslint.json"] | Version 0.22.0 breaks TypeScript apps | #### Describe the bug
Upgrading from version 0.21.4 to 0.22.0 fails to compile a TypeScript app.
#### To Reproduce
Have a code that looks like this
```ts
import axios from 'axios';
const func = () => {
delete axios.defaults.headers.common.Authorization;
}
```
Request responses are also incorrectly inferred after this update. Instead of `any`, data will be set to `Params`.
```ts
import axios from 'axios';
export const request = async (params: Params): Promise<Response> => {
const { data } = await axios.put('urlPath', params);
return data;
};
```
#### Expected behavior
There should be no breaking changes as change log doesn't mention them.
#### Environment
- Axios Version [e.g. 0.18.0] 0.22.0
- Adapter [e.g. XHR/HTTP] -
- Browser [e.g. Chrome, Safari] -
- Browser Version [e.g. 22] -
- Node.js Version [e.g. 13.0.1] -
- OS: [e.g. iOS 12.1.0, OSX 10.13.4] -
- Additional Library Versions [e.g. React 16.7, React Native 0.58.0] React 17.0.2
#### Additional context/Screenshots
Add any other context about the problem here. If applicable, add screenshots to help explain.
| https://github.com/axios/axios/issues/4157 | https://github.com/axios/axios/pull/4140 | fce210a67e240820cc2c9b146ac80ba6985b8477 | 94a93447992392441f1928dffc9f10529ecec417 | "2021-10-07T11:30:43Z" | javascript | "2021-10-12T07:53:10Z" |
closed | axios/axios | https://github.com/axios/axios | 4,153 | ["Gruntfile.js", "index.d.ts", "package.json", "test/typescript/axios.ts", "tsconfig.json", "tslint.json"] | Uncaught TypeError is raised for axios.create with axios version 0.22.0 | <!-- Click "Preview" for a more readable version --
Please read and follow the instructions before submitting an issue:
- Read all our documentation, especially the [README](https://github.com/axios/axios/blob/master/README.md). It may contain information that helps you solve your issue.
- Ensure your issue isn't already [reported](https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=is%3Aissue).
- If you aren't sure that the issue is caused by Axios or you just need help, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/axios) or [our chat](https://gitter.im/mzabriskie/axios).
- If you're reporting a bug, ensure it isn't already fixed in the latest Axios version.
- Don't remove any title of the issue template, or it will be treated as invalid by the bot.
⚠️👆 Feel free to these instructions before submitting the issue 👆⚠️
-->
#### Describe the bug
Uncaught TypeError is raised for axios.create with axios version 0.22.0
Issue is observed while merging the defaultConfig, with instanceConfig.
We are setting instanceConfig only
#### To Reproduce
Exception is raised while creating axios instance with below sample code.
```js
const service = axios.create({
baseURL: "host",
timeout: 3000
})
```
#### Expected behavior
Same works with axios version 0.21.4
#### Environment
- Axios Version [0.22.0]
- Browser [Chrome, Edge]
- Browser Version [Version 94.0.4606.71 (Official Build) (64-bit)]
- Node.js Version [14.15.1]
- Additional Library Versions [VueJS 3.2.19, vue-axios 3.3.7]
#### Additional context/Screenshots
Exception stack trace
axios.js:1308 Uncaught TypeError: Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at mergeConfig (axios.js:1308)
at Function.create (axios.js:1712)
| https://github.com/axios/axios/issues/4153 | https://github.com/axios/axios/pull/4140 | fce210a67e240820cc2c9b146ac80ba6985b8477 | 94a93447992392441f1928dffc9f10529ecec417 | "2021-10-07T08:41:44Z" | javascript | "2021-10-12T07:53:10Z" |
closed | axios/axios | https://github.com/axios/axios | 4,141 | ["index.d.ts", "test/typescript/axios.ts"] | Revert #3002 - set type of data to any | <!-- Click "Preview" for a more readable version --
Please read and follow the instructions before submitting an issue:
- Read all our documentation, especially the [README](https://github.com/axios/axios/blob/master/README.md). It may contain information that helps you solve your issue.
- Ensure your issue isn't already [reported](https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=is%3Aissue).
- If you aren't sure that the issue is caused by Axios or you just need help, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/axios) or [our chat](https://gitter.im/mzabriskie/axios).
- If you're reporting a bug, ensure it isn't already fixed in the latest Axios version.
- Don't remove any title of the issue template, or it will be treated as invalid by the bot.
⚠️👆 Feel free to these instructions before submitting the issue 👆⚠️
-->
#### Is your feature request related to a problem? Please describe.
Yes. After #3002 was merged, we are now required to set explicit type definitions for every single axios request we make, even if we don't want to, because these would result in an error.
#### Describe the solution you'd like
The default type for AxiosResponse#data should be any so that we can modify it if we want, or keep it as is if we don't care about the typings for that specific request
#### Describe alternatives you've considered
As suggested in that PR, we could set the type to `any` explicitly, however, many people use typescript-eslint's [no-explicit-any](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-explicit-any.md) rule that prevents us from doing this. I believe everyone should be able to choose what types they wanna work with, because for extremely simple responses from which you only need one or two simple properties you don't always need explicit type declarations
#### Additional context
TypeScript's DOM library sets the return type of Body#toJSON to Promise<any>, so we should be following the native approach and not restricting user's options by setting a default that "most users may want", even if most users do not want this. | https://github.com/axios/axios/issues/4141 | https://github.com/axios/axios/pull/4186 | 1025d1231a7747503188459dd5a6d1effdcea928 | 2c9cc76ee9cce0a144a68d5a6b2b8f4da89c6e15 | "2021-10-05T14:00:06Z" | javascript | "2021-10-22T08:14:23Z" |
closed | axios/axios | https://github.com/axios/axios | 4,132 | ["Gruntfile.js", "index.d.ts", "package.json", "test/typescript/axios.ts", "tsconfig.json", "tslint.json"] | POST call expected response body type also set to request body type | <!-- Click "Preview" for a more readable version --
Please read and follow the instructions before submitting an issue:
- Read all our documentation, especially the [README](https://github.com/axios/axios/blob/master/README.md). It may contain information that helps you solve your issue.
- Ensure your issue isn't already [reported](https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=is%3Aissue).
- If you aren't sure that the issue is caused by Axios or you just need help, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/axios) or [our chat](https://gitter.im/mzabriskie/axios).
- If you're reporting a bug, ensure it isn't already fixed in the latest Axios version.
- Don't remove any title of the issue template, or it will be treated as invalid by the bot.
⚠️👆 Feel free to these instructions before submitting the issue 👆⚠️
-->
#### Describe the bug
When specifying an expected `response.data` type to the post method it also sets that expected type to the request body. Also, when not specifying a type, the type for the `response.data` gets inferred to be the same as the type of the request body. This leads to typescript errors in VS Code and during compile time when the response and request bodies in code doesn't have the same type (which is usually the case). This was not an issue in v0.21.4 - which I reverted to in order to get around this issue.
#### To Reproduce
1. Install axios v0.22.0
2. Add a type for the `response.data` like in this example:
```tsx
axios.post<ExpectedResponseBody>(`post url`, { foo: "bar" }, {});
```
Also look at the CodeSandbox example [here](https://codesandbox.io/s/axios-v0-22-0-type-issue-joty3?file=/src/App.tsx:897-1031)
#### Expected behavior
When specifying the expected type of the `response.data` in the post call, the request body shouldn't have the same expected type. And the inferred type for the request body shouldn't automatically get applied to `response.data`.
#### Environment
- Axios Version 0.22.0
- Adapter N/A
- Browser N/A
- Browser Version N/A
- Node.js Version: 14.17.3
- OS: Win 10
- Additional Library Versions: Typescript 4.4.3
#### Additional context/Screenshots
Type for post method in axios v0.21.4

Type for post method in axios v0.22.0. Note that `T` is also set to request data and config in this version - which is what I believe is the cause of the issue.

| https://github.com/axios/axios/issues/4132 | https://github.com/axios/axios/pull/4140 | fce210a67e240820cc2c9b146ac80ba6985b8477 | 94a93447992392441f1928dffc9f10529ecec417 | "2021-10-04T09:16:49Z" | javascript | "2021-10-12T07:53:10Z" |
closed | axios/axios | https://github.com/axios/axios | 4,108 | ["Gruntfile.js", "index.d.ts", "package.json", "test/typescript/axios.ts", "tsconfig.json", "tslint.json"] | defaults.headers.common is of type string instead of Record<string, string> | <!-- Click "Preview" for a more readable version --
Please read and follow the instructions before submitting an issue:
- Read all our documentation, especially the [README](https://github.com/axios/axios/blob/master/README.md). It may contain information that helps you solve your issue.
- Ensure your issue isn't already [reported](https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=is%3Aissue).
- If you aren't sure that the issue is caused by Axios or you just need help, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/axios) or [our chat](https://gitter.im/mzabriskie/axios).
- If you're reporting a bug, ensure it isn't already fixed in the latest Axios version.
- Don't remove any title of the issue template, or it will be treated as invalid by the bot.
⚠️👆 Feel free to these instructions before submitting the issue 👆⚠️
-->
#### Describe the issue
Headers are typed as `Record<string, string>`. This includes `axios.defaults.headers`, which is configured as: https://github.com/axios/axios/blob/76f09afc03fbcf392d31ce88448246bcd4f91f8c/lib/defaults.js#L119-L123
This seems incompatible with `headers` being of type `Record<string, string>`.
#### Example Code
The following line produces a TypeScript error beacuse `headers.commons` is of type `string`: "Element implicitly has an 'any' type because index expression is not of type 'number'.ts(7015)".
```ts
axios.defaults.headers.common['Authorization'] = AUTH_TOKEN
```
#### Expected behavior, if applicable
I expect to be able to configure default headers without TypeScript errors. Using the code examples from the Axios documentation, I would exspect `axios.defaults.headers.common` to be of type `Record<string, string>` not of type `string`.
#### Environment
- Axios Version 0.22.0
- Adapter N/A
- Browser N/A
- Browser Version N/A
- Node.js Version 15.14.0
- OS: Ubuntu 21.04
- Additional Library Versions TypeScript 4.4.3
#### Additional context/Screenshots
Add any other context about the problem here. If applicable, add screenshots to help explain.
| https://github.com/axios/axios/issues/4108 | https://github.com/axios/axios/pull/4140 | fce210a67e240820cc2c9b146ac80ba6985b8477 | 94a93447992392441f1928dffc9f10529ecec417 | "2021-10-01T08:39:14Z" | javascript | "2021-10-12T07:53:10Z" |
closed | axios/axios | https://github.com/axios/axios | 3,979 | ["lib/utils.js"] | [Security] Regular expression Denial of Service (ReDoS) | #### Describe the bug
A ReDoS (regular expression denial of service) flaw was found in the axios package. An attacker that is able to provide crafted input to the trim function may cause an application to consume an excessive amount of CPU.
https://www.huntr.dev/bounties/1e8f07fc-c384-4ff9-8498-0690de2e8c31/
#### To Reproduce
Code snippet to reproduce, ideally, that will work by pasting into something like https://npm.runkit.com/axios
```js
var {trim} = require("axios/lib/utils");
function build_blank (n) {
var ret = "1"
for (var i = 0; i < n; i++) {
ret += " "
}
return ret + "1";
}
var time = Date.now();
trim(build_blank(50000))
var time_cost = Date.now() - time;
console.log("time_cost: " + time_cost)
```
#### Expected behavior
#### Environment
- Axios Version [e.g. 0.21.1]
- Adapter [e.g. XHR/HTTP]
- Browser [e.g. Chrome, Safari]
- Browser Version [e.g. 22]
- Node.js Version [e.g. 14.17.5]
- OS: [e.g. iOS 12.1.0, OSX 10.13.4]
- Additional Library Versions [e.g. React 16.7, React Native 0.58.0]
#### Additional context/Screenshots
Add any other context about the problem here. If applicable, add screenshots to help explain.
| https://github.com/axios/axios/issues/3979 | https://github.com/axios/axios/pull/3980 | 5bc9ea24dda14e74def0b8ae9cdb3fa1a0c77773 | 5b457116e31db0e88fede6c428e969e87f290929 | "2021-08-26T14:17:32Z" | javascript | "2021-08-30T12:33:43Z" |
closed | axios/axios | https://github.com/axios/axios | 3,903 | ["lib/adapters/http.js", "package.json", "test/unit/adapters/http.js"] | Requests to https through proxy | #### Is your feature request related to a problem? Please describe.
Axios 0.21.1 does not cope with requests through proxy to secured URLs - HTTP code 501 is received.
I'm behind corporate network. When I try to launch the following code, the error 501 is received:
```
const axios = require("axios");
axios.get('https://jsonplaceholder.typicode.com/todos/12', {
proxy: {
protocol: 'http',
host: 'corporate.proxy',
port: 9000
},
})
.then(response => response.data)
.then(data => console.log(data))
.catch((error) => {
const errorMessage = error.message;
const responseData = error.response && error.response.data;
console.log('error')
console.log(`${errorMessage}${
responseData
&& typeof responseData === 'object'
? `: ${JSON.stringify(responseData)}`
: ''}`)
});
```
Requests made to unsecured URLs - http protocol - with or without proxy settings succeed.
#### Describe the solution you'd like
Fix or implement please a possibility to perform requests to secured URLs - https protocol - through proxy.
#### Describe alternatives you've considered
Instead of using "axios" module, the module "axios-https-proxy-fix" solves the issue. However, it's some old fix. And most probably does not update to new features that original Axios may bring. Definitely I would like to stick to primary.
#### Additional context
No solution is found around the original source.
| https://github.com/axios/axios/issues/3903 | https://github.com/axios/axios/pull/4436 | de5e006142cb428e712d00c05bda17c3c4c83ef1 | 495d5fb1333f2cb0c7e49ecfd6470dd1700ca96c | "2021-07-20T07:11:36Z" | javascript | "2022-05-11T17:24:14Z" |
closed | axios/axios | https://github.com/axios/axios | 3,887 | ["lib/adapters/http.js", "lib/helpers/ZlibHeaderTransformStream.js", "test/unit/adapters/http.js"] | Deflate fails on server response without zlib header | <!-- Click "Preview" for a more readable version --
Please read and follow the instructions before submitting an issue:
- Read all our documentation, especially the [README](https://github.com/axios/axios/blob/master/README.md). It may contain information that helps you solve your issue.
- Ensure your issue isn't already [reported](https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=is%3Aissue).
- If you aren't sure that the issue is caused by Axios or you just need help, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/axios) or [our chat](https://gitter.im/mzabriskie/axios).
- If you're reporting a bug, ensure it isn't already fixed in the latest Axios version.
- Don't remove any title of the issue template, or it will be treated as invalid by the bot.
⚠️👆 Feel free to these instructions before submitting the issue 👆⚠️
-->
#### Describe the bug
Some servers are not sending a zlib header in their deflated data. CURL had the same problem and implemented a "fix" for it: https://github.com/curl/curl/blob/5c932f8fe9dad94a7417702958ffa9e8db67c549/lib/content_encoding.c#L227-L229
Axios is also returning a `Z_DATA_ERROR` in this case.
#### To Reproduce
Use axios to request a page without a zlib header in the deflated data (e.g. https://www.konicaminolta.eu/eu-en/about-us/corporate-book) and force it to only accept deflate encoding.
```js
let url = 'https://www.konicaminolta.eu/eu-en/about-us/corporate-book';
let config = {
headers: { 'Accept-Encoding': 'deflate' }
};
await axios.get(url, config);
```
#### Expected behavior
Getting the correctly inflated data.
#### Environment
- Axios Version [0.21.1]
#### Additional context/Screenshots
| https://github.com/axios/axios/issues/3887 | https://github.com/axios/axios/pull/5497 | 9915635c69d0ab70daca5738488421f67ca60959 | 65e8d1e28ce829f47a837e45129730e541950d3c | "2021-07-07T06:49:51Z" | javascript | "2023-01-30T22:49:37Z" |
closed | axios/axios | https://github.com/axios/axios | 3,769 | ["lib/adapters/http.js", "test/unit/adapters/http.js"] | maxBodyLength does not work with disabled redirects | #### Describe the bug
maxBodyLength does not work with disabled redirects like when using `{ maxRedirects: 0, maxBodyLength: 100 }` in options.
#### To Reproduce
```js
require("axios")
.put("http://www.example.com", Buffer.alloc(1000), { maxRedirects: 0, maxBodyLength: 100 })
.catch(e => console.log("axios returned error:", e));
```
#### Expected behavior
It should print something like:
```
axios returned error: Error [ERR_FR_MAX_BODY_LENGTH_EXCEEDED]: Request body larger than maxBodyLength limit
...
```
As this example does:
```js
require("axios")
.put("http://www.example.com", Buffer.alloc(1000), { maxBodyLength: 100 })
.catch(e => console.log("axios returned error:", e));
```
#### Environment
- Axios Version 0.21.1
- Adapter HTTP
- Node.js Version v15.12.0
#### Additional context/Screenshots
| https://github.com/axios/axios/issues/3769 | https://github.com/axios/axios/pull/3786 | 962f9ab7129f38024f73a75e2869feaa6eb2d260 | c00c4ddd87fc616e85b64ed4cfad19eec44f49a6 | "2021-04-28T18:15:35Z" | javascript | "2021-12-23T08:19:02Z" |
closed | axios/axios | https://github.com/axios/axios | 3,751 | ["package-lock.json"] | React+axios: global catch interceptor still requires me to add a catch clause per request | <!-- Click "Preview" for a more readable version --
Please read and follow the instructions before submitting an issue:
- Read all our documentation, especially the [README](https://github.com/axios/axios/blob/master/README.md). It may contain information that helps you solve your issue.
- Ensure your issue isn't already [reported](https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=is%3Aissue).
- If you aren't sure that the issue is caused by Axios or you just need help, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/axios) or [our chat](https://gitter.im/mzabriskie/axios).
- If you're reporting a bug, ensure it isn't already fixed in the latest Axios version.
- Don't remove any title of the issue template, or it will be treated as invalid by the bot.
⚠️👆 Feel free to these instructions before submitting the issue 👆⚠️
-->
#### Describe the issue
When setting a global catch interceptor, I still need to define a catch clause, otherwise I get an error page of un handled rejection. If I don't throw an error from the interceptor, the "then" clause is executing which is wrong.
#### Example Code
```
apiClient.interceptors.response.use(response => response, error => {
//do some stuff
throw error; //<<<<< see below for details
})
apiClient.post("/login", {.....}).then((response) => {
alert(response);
}).catch(ignored => {
});
```
#### Expected behavior, if applicable
If a global interceptor is defined, either I won't be forced to add a catch clause per request or when not throwing an error, the "then" clause should't be executed.
#### Environment
- Axios Version 0.21.1
- Adapter HTTP
- Browser Firefox
- Browser Version 87
- OS: Windows 10
- Additional Library Versions: React 17.0.2
#### Additional context/Screenshots
Add any other context about the problem here. If applicable, add screenshots to help explain.
| https://github.com/axios/axios/issues/3751 | https://github.com/axios/axios/pull/4461 | 73e3bdb8835ba942096b662e9441f1d85ce4d484 | 447a24dfc337f93d35b9a8bed7629a76f7aed6bf | "2021-04-15T23:37:00Z" | javascript | "2022-02-13T13:45:14Z" |
closed | axios/axios | https://github.com/axios/axios | 3,702 | ["lib/adapters/http.js", "test/unit/adapters/http.js"] | Can't completely remove User-Agent Header | #### Is your feature request related to a problem? Please describe.
Some APIs only work if the User-Agent header is entirely omitted. This is not currently possible in Axios in NodeJS. #1411 opened this discussion some time back, but was closed without an actual solution other than commenting out the code which inserts the header.
#### Describe the solution you'd like
There should be a way to completely omit the U-A header if desired. User-Agent is not a required header, and its deprecation (in favor of Client-Hints) is being actively discussed.
The simplest solution would probably to retain the current behavior if no User-Agent header is specified, but omit the header if it is explicitly provided with a falsy value (`null` and `""` both seem to clearly communicate the caller's intent not to have a value here).
#### Describe alternatives you've considered
Explicit options to disable the current behavior could work, but that seems like a less-elegant path.
#### Additional context
No.
| https://github.com/axios/axios/issues/3702 | https://github.com/axios/axios/pull/3703 | c0317b745306ba312437a04803b8d3ea46390181 | b0959f0301d3c1bb5ca673c20a58907e94e3743d | "2021-03-23T20:09:14Z" | javascript | "2021-03-29T14:47:29Z" |
closed | axios/axios | https://github.com/axios/axios | 3,606 | ["lib/adapters/http.js", "test/unit/adapters/http.js"] | response interceptor should have request infomation on error | #### Describe the bug
This bugreport very similar to #315 which was implemented and fixed, however I think this is not solved yet. When the query params parsing process itself fails (before the request even started), the resulting error object does not contain request information, making it hard to debug, especially with as error reports.
#### To Reproduce
```js
axios.get("", {
params: {
someParam: new Date(undefined)
}
}).catch((e) => {
console.log(e);
})
```
Only prints
```
RangeError: Invalid time value
at Date.toISOString (<anonymous>)
at parseValue (buildURL.js:53)
at Object.forEach (utils.js:219)
at serialize (buildURL.js:51)
at Object.forEach (utils.js:225)
at buildURL (buildURL.js:38)
at dispatchXhrRequest (xhr.js:45)
at new Promise (<anonymous>)
at xhrAdapter (xhr.js:13)
at dispatchRequest (dispatchRequest.js:53)
```
#### Expected behavior
I would expect the error to have information about the request (uri, config, etc) just like when the error is thrown on server response error.
#### Environment
- Axios Version 0.21.1
- Adapter http
- Browser chromium
- Browser Version 87.0.4280.141
- Node.js Version 12.20.0
- OS: Manjaro 20.2.1
- Additional Library Versions none
#### Additional context/Screenshots
dont have any. – I dont think that omitting this category should result in the automatic closing of an issue :-/
Cheers
| https://github.com/axios/axios/issues/3606 | https://github.com/axios/axios/pull/3961 | 4461761fcb75a63fe4eab217e9e9632f48aa4dee | 1163588aa288160282866057efcaef57dbbe417b | "2021-01-28T19:59:28Z" | javascript | "2022-01-18T16:50:33Z" |
closed | axios/axios | https://github.com/axios/axios | 3,580 | ["lib/adapters/http.js", "test/unit/adapters/http.js"] | The timeoutErrorMessage property in config not work with Node.js | <!-- Click "Preview" for a more readable version --
Please read and follow the instructions before submitting an issue:
- Read all our documentation, especially the [README](https://github.com/axios/axios/blob/master/README.md). It may contain information that helps you solve your issue.
- Ensure your issue isn't already [reported](https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=is%3Aissue).
- If you aren't sure that the issue is caused by Axios or you just need help, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/axios) or [our chat](https://gitter.im/mzabriskie/axios).
- If you're reporting a bug, ensure it isn't already fixed in the latest Axios version.
- Don't remove any title of the issue template, or it will be treated as invalid by the bot.
⚠️👆 Feel free to these instructions before submitting the issue 👆⚠️
-->
#### Describe the bug
The timeoutErrorMessage property in config not work with Node.js, expected custom error message, got "**timeout of \*ms exceeded**"
#### To Reproduce
```js
it('should respect the timeoutErrorMessage property', function (done) {
server = http.createServer(function (req, res) {
setTimeout(function () {
res.end();
}, 1000);
}).listen(4444, function () {
var success = false, failure = false;
var error;
axios.get('http://localhost:4444/', {
timeout: 250,
timeoutErrorMessage: 'oops, timeout',
}).then(function (res) {
success = true;
}).catch(function (err) {
error = err;
failure = true;
});
setTimeout(function () {
assert.strictEqual(success, false, 'request should not succeed');
assert.strictEqual(failure, true, 'request should fail');
assert.strictEqual(error.code, 'ECONNABORTED');
assert.strictEqual(error.message, 'oops, timeout');
done();
}, 300);
});
});
```
#### Expected behavior
Expected: oops, timeout
Got: timeout of 250ms exceeded
#### Environment
- Axios Version: 0.21.1
- Adapter: HTTP
- Browser: none
- Browser Version: none
- Node.js Version: 12.19.0
- OS: MacOS 10.14
- Additional Library Versions: none
#### Additional context/Screenshots

| https://github.com/axios/axios/issues/3580 | https://github.com/axios/axios/pull/3581 | 5c5cbdf4ba1e2b55b6bff35673bdd5206b4eddf8 | 4461761fcb75a63fe4eab217e9e9632f48aa4dee | "2021-01-22T17:10:24Z" | javascript | "2022-01-18T16:40:18Z" |
closed | axios/axios | https://github.com/axios/axios | 3,448 | ["index.d.ts"] | Support developers to customize return types in the interceptors. | <!-- Click "Preview" for a more readable version --
Please read and follow the instructions before submitting an issue:
- Read all our documentation, especially the [README](https://github.com/axios/axios/blob/master/README.md). It may contain information that helps you solve your issue.
- Ensure your issue isn't already [reported](https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=is%3Aissue).
- If you aren't sure that the issue is caused by Axios or you just need help, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/axios) or [our chat](https://gitter.im/mzabriskie/axios).
- If you're reporting a bug, ensure it isn't already fixed in the latest Axios version.
- Don't remove any title of the issue template, or it will be treated as invalid by the bot.
⚠️👆 Feel free to these instructions before submitting the issue 👆⚠️
-->
#### Is your feature request related to a problem? Please describe.
I was using `interceptors` like
```js
axios.interceptors.response.use(function (
response: AxiosResponse<YApiResponseBody>
): YApiResponseBody {
return response.data
},
```
However, I got the error
> Argument of type '(response: AxiosResponse<YApiResponseBody>) => YApiResponseBody' is not assignable to parameter of type '(value: AxiosResponse<any>) => AxiosResponse<any> | Promise<AxiosResponse<any>>'.
Yeah, I know the error means, however, I just want to return the `response.data` directly. How can I accomplish that?
#### Describe the solution you'd like
#### Describe alternatives you've considered
I was thinking if `AxiosInterceptorManager` can accept `any` in `onFulfilled`. In that case, the error won't appear again.
```diff
export interface AxiosInterceptorManager<V> {
- use(onFulfilled?: (value: V) =>V | Promise<V>, onRejected?: (error: any) => any): number;
+ use(onFulfilled?: (value: V) =>any , onRejected?: (error: any) => any): number;
eject(id: number): void;
}
export interface AxiosInstance {
(config: AxiosRequestConfig): AxiosPromise;
(url: string, config?: AxiosRequestConfig): AxiosPromise;
defaults: AxiosRequestConfig;
interceptors: {
request: AxiosInterceptorManager<AxiosRequestConfig>;
response: AxiosInterceptorManager<AxiosResponse>;
};
//...
}
```
I have seen https://github.com/axios/axios/issues/1510 and https://github.com/axios/axios/pull/1605. I didn't find a solution.
#### Additional context
| https://github.com/axios/axios/issues/3448 | https://github.com/axios/axios/pull/3783 | 49509f6e95c20d3ad5af460b7e18e44325cf9391 | 69949a6c161d954570a314c0e48b57d3ffd90326 | "2020-11-29T07:23:23Z" | javascript | "2021-05-14T14:08:36Z" |
closed | axios/axios | https://github.com/axios/axios | 3,407 | ["lib/adapters/http.js", "test/unit/regression/SNYK-JS-AXIOS-1038255.js"] | Possible bug: Vulnerability SSRF | <!-- Click "Preview" for a more readable version --
Please read and follow the instructions before submitting an issue:
- Read all our documentation, especially the [README](https://github.com/axios/axios/blob/master/README.md). It may contain information that helps you solve your issue.
- Ensure your issue isn't already [reported](https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=is%3Aissue).
- If you aren't sure that the issue is caused by Axios or you just need help, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/axios) or [our chat](https://gitter.im/mzabriskie/axios).
- If you're reporting a bug, ensure it isn't already fixed in the latest Axios version.
- Don't remove any title of the issue template, or it will be treated as invalid by the bot.
⚠️👆 Feel free to these instructions before submitting the issue 👆⚠️
-->
#### Describe the bug
In my current project we are using Snyk to catch any possible issues and vulnerabilities.
Snyk reports that since version 0.19.0 there is SSRF vulnerability that has no been fixed yet.
This is the message:
``Affected versions of this package are vulnerable to Server-Side Request Forgery (SSRF). An attacker is able to bypass a proxy by providing a URL that responds with a redirect to a restricted host or IP address.``
Could you please verify?
Thanks in advance.
#### To Reproduce
Any pen tests or just using Snyk to scan any app that uses axios.
#### Expected behavior
No vulnerabilities alerts.
#### Environment
- Axios Version [0.21.0]
- Adapter [HTTP]
- Browser [All]
- Browser Version [x]
- Node.js Version [12.14.1]
- OS: [x]
- Additional Library Versions [x]
#### Additional context/Screenshots
Add any other context about the problem here. If applicable, add screenshots to help explain.
| https://github.com/axios/axios/issues/3407 | https://github.com/axios/axios/pull/3410 | f472e5da5fe76c72db703d6a0f5190e4ad31e642 | c7329fefc890050edd51e40e469a154d0117fc55 | "2020-11-12T15:41:36Z" | javascript | "2020-11-24T06:44:00Z" |
closed | axios/axios | https://github.com/axios/axios | 3,374 | ["lib/defaults.js", "test/unit/defaults/transformReponse.js"] | Do not apply data tansformation to the empty 204 status code responses | #### Describe the bug
For responses with status code 204 Chrome debugger catch exception and stop application debugging in empty string parse catch. We need to avoid obvious error catching.
#### To Reproduce
If I set pause on exceptions in Chrome debugger and response has status code 204 axios always do data transformation and paused in place where it is trying to parse empty string:
` transformResponse: [function transformResponse(data) {
/*eslint no-param-reassign:0*/
if (typeof data === 'string') {
try {
data = JSON.parse(data);
} catch (e) { /* Ignore */ }
}
return data;
}],`
Of course I can override transformResponse, but it is not very user friendly. So instead I suggest just to add additional check here:
https://github.com/axios/axios/blob/768825589fd0d36b64a66717ca6df2efd8fb7844/lib/core/dispatchRequest.js#L55
```
if (response.status !== 204) {
// Do transformation
}
```
I think this is a good solution as http status code 204 mean an empty response body and it will save one extra parsing that is catching the error. Is there any other thoughts on this?
#### Expected behavior
No data transformation should happen for responses with status code 204.
#### Environment
- Axios Version [e.g. 0.18.0]
- Adapter [e.g. XHR/HTTP]
- Browser [e.g. Chrome, Safari]
- Browser Version [e.g. 22]
- Node.js Version [e.g. 13.0.1]
- OS: [e.g. iOS 12.1.0, OSX 10.13.4]
- Additional Library Versions [e.g. React 16.7, React Native 0.58.0]
#### Additional context/Screenshots
Add any other context about the problem here. If applicable, add screenshots to help explain.

| https://github.com/axios/axios/issues/3374 | https://github.com/axios/axios/pull/3377 | 364867edd295b5ea0019b4e70fd37be5a5b751ee | f2057f77b231d88ea94ad88e84e4fd9f99506880 | "2020-10-30T23:26:47Z" | javascript | "2021-03-24T06:22:03Z" |
closed | axios/axios | https://github.com/axios/axios | 3,369 | ["lib/adapters/http.js", "test/unit/regression/SNYK-JS-AXIOS-1038255.js"] | Requests that follow a redirect are not passing via the proxy | <!-- Click "Preview" for a more readable version --
Please read and follow the instructions before submitting an issue:
- Read all our documentation, especially the [README](https://github.com/axios/axios/blob/master/README.md). It may contain information that helps you solve your issue.
- Ensure your issue isn't already [reported](https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=is%3Aissue).
- If you aren't sure that the issue is caused by Axios or you just need help, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/axios) or [our chat](https://gitter.im/mzabriskie/axios).
- If you're reporting a bug, ensure it isn't already fixed in the latest Axios version.
- Don't remove any title of the issue template, or it will be treated as invalid by the bot.
⚠️👆 Feel free to these instructions before submitting the issue 👆⚠️
-->
#### Describe the bug
In cases where `axios` is used by servers to perform http requests to user-supplied urls, a proxy is commonly used to protect internal networks from unauthorized access and [SSRF](https://en.wikipedia.org/wiki/Server-side_request_forgery). This bug enables an attacker to bypass the proxy by providing a url that responds with a redirect to a restricted host/ip.
#### To Reproduce
The following code spawns a proxy server that *always* responds with a 302 redirect, so requests should never reach the target url, however, `axios` is only reaching the proxy once, and bypassing the proxy after the redirect response.
https://runkit.com/embed/1df5qy8lbgnc
```js
const axios = require('axios')
const http = require('http')
const PROXY_PORT = 8080
// A fake proxy server
http.createServer(function (req, res) {
res.writeHead(302, {location: 'http://example.com'})
res.end()
}).listen(PROXY_PORT)
axios({
method: "get",
url: "http://www.google.com/",
proxy: {
host: "localhost",
port: PROXY_PORT,
},
})
.then((r) => console.log(r.data))
.catch(console.error)
```
The response is the rendered html of _http://example.com_
#### Expected behavior
*All* the requests should pass via the proxy. In the provided scenario, there should be a redirect loop.
#### Environment
- Axios Version [0.21.0]
- Node.js Version [v12.18.2]
#### Additional context/Screenshots
Add any other context about the problem here. If applicable, add screenshots to help explain.
| https://github.com/axios/axios/issues/3369 | https://github.com/axios/axios/pull/3410 | f472e5da5fe76c72db703d6a0f5190e4ad31e642 | c7329fefc890050edd51e40e469a154d0117fc55 | "2020-10-29T14:37:32Z" | javascript | "2020-11-24T06:44:00Z" |
closed | axios/axios | https://github.com/axios/axios | 3,286 | ["lib/adapters/xhr.js", "test/specs/__helpers.js"] | RequestHeaders.Authorization parameter concatenation failed | <!-- Click "Preview" for a more readable version --
Please read and follow the instructions before submitting an issue:
- Read all our documentation, especially the [README](https://github.com/axios/axios/blob/master/README.md). It may contain information that helps you solve your issue.
- Ensure your issue isn't already [reported](https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=is%3Aissue).
- If you aren't sure that the issue is caused by Axios or you just need help, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/axios) or [our chat](https://gitter.im/mzabriskie/axios).
- If you're reporting a bug, ensure it isn't already fixed in the latest Axios version.
- Don't remove any title of the issue template, or it will be treated as invalid by the bot.
⚠️👆 Feel free to these instructions before submitting the issue 👆⚠️
-->
#### Describe the bug
In situations that use Basic auth and do not pass the parameter "password" _**requestHeaders.Authorization**_ is concatenated unduly "**: undefined**".
#### To Reproduce
Any request using **Basic Authentication** without passing the parameter "**password**" as an example below.
```js
var axios = require("axios")
const instance = axios.create();
instance.request({
method: 'POST',
baseURL: ".../XPTO",
auth: { username: "janedoe" }}
).then(
// do something
);
```
#### Expected behavior
To maintain compatibility with previous versions, the proper behavior would be to test if the parameter "**password**" was passed, otherwise concatenate empty.
#### Environment
- Axios Version [e.g. 0.20.0]
- Adapter [e.g. XHR/HTTP]
- Browser [e.g. Chrome, Safari]
- Browser Version [e.g. 22]
- Node.js Version [e.g. 13.0.1]
- OS: [e.g. iOS 12.1.0, OSX 10.13.4]
- Additional Library Versions [e.g. React 16.7, React Native 0.58.0]
#### Additional context/Screenshots
A problem arising from the lack of compatibility with previous versions is to force all current projects that do not pass a "password" parameter to have to include this parameter with an empty value. | https://github.com/axios/axios/issues/3286 | https://github.com/axios/axios/pull/3287 | e8c6e191410b05c496637768301debdcb7669c65 | 04d45f20911a02e9457db9e9d104aa156e170b11 | "2020-09-13T20:06:38Z" | javascript | "2020-09-20T02:19:48Z" |
closed | axios/axios | https://github.com/axios/axios | 3,220 | ["lib/core/Axios.js", "test/specs/requests.spec.js"] | Axios does not use data from config when making DELETE request | <!-- Click "Preview" for a more readable version --
Please read and follow the instructions before submitting an issue:
- Read all our documentation, especially the [README](https://github.com/axios/axios/blob/master/README.md). It may contain information that helps you solve your issue.
- Ensure your issue isn't already [reported](https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=is%3Aissue).
- If you aren't sure that the issue is caused by Axios or you just need help, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/axios) or [our chat](https://gitter.im/mzabriskie/axios).
- If you're reporting a bug, ensure it isn't already fixed in the latest Axios version.
- Don't remove any title of the issue template, or it will be treated as invalid by the bot.
⚠️👆 Feel free to these instructions before submitting the issue 👆⚠️
-->
#### Describe the bug
Axios last version (0.20.0) does not use data from config when making DELETE request. In 0.19.2 it's working fine
#### To Reproduce
```js
axios.delete("...", {
data: { ids: [...] },
}).then(response => {
...
}).catch(error => {
...
});
```
#### Expected behavior
Axios send request data from config when making DELETE request
#### Environment
- Axios Version 0.20.0
- Browser Chrome
- Browser Version 84.0.4147.125
- Node.js Version 12.18.3
- OS: Linux Mint
- Additional Library Versions React 16.13.1
#### Additional context/Screenshots
None
| https://github.com/axios/axios/issues/3220 | https://github.com/axios/axios/pull/3282 | b7e954eba3911874575ed241ec2ec38ff8af21bb | fa3673710ea6bb3f351b4790bb17998d2f01f342 | "2020-08-21T09:04:05Z" | javascript | "2020-10-01T07:46:32Z" |
closed | axios/axios | https://github.com/axios/axios | 3,163 | ["README.md"] | It's not documented what happens if request is started with already cancelled token. | #### Section/Content To Improve
https://github.com/axios/axios#cancellation
#### Suggested Improvement
Document what will happen if I pass already cancelled token to axios request. Will it try to make a request ?
#### Relevant File(s)
no | https://github.com/axios/axios/issues/3163 | https://github.com/axios/axios/pull/3803 | 69949a6c161d954570a314c0e48b57d3ffd90326 | 3958e9fbc8ebc0f72a8ce568cbf86f391d6869f3 | "2020-08-01T12:41:56Z" | javascript | "2021-05-18T07:08:20Z" |
closed | axios/axios | https://github.com/axios/axios | 2,819 | ["lib/core/Axios.js", "lib/core/dispatchRequest.js", "lib/core/mergeConfig.js", "lib/utils.js", "test/specs/core/mergeConfig.spec.js", "test/specs/headers.spec.js", "test/specs/requests.spec.js", "test/specs/utils/deepMerge.spec.js", "test/specs/utils/isX.spec.js", "test/specs/utils/merge.spec.js"] | Param with value of null is replaced with "{}" | <!-- Click "Preview" for a more readable version --
Please read and follow the instructions before submitting an issue:
- Read all our documentation, especially the [README](https://github.com/axios/axios/blob/master/README.md). It may contain information that helps you solve your issue.
- Ensure your issue isn't already [reported](https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=is%3Aissue).
- If you aren't sure that the issue is caused by Axios or you just need help, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/axios) or [our chat](https://gitter.im/mzabriskie/axios).
- If you're reporting a bug, ensure it isn't already fixed in the latest Axios version.
⚠️👆 Feel free to these instructions before submitting the issue 👆⚠️
-->
**Describe the bug**
Param with value of null is replaced with "{}"
**To Reproduce**
axios.get('/whatever', {params: {test: null}}) used to make GET request to /whatever, now it's /whatever?test=%7B%7D
**Expected behavior**
Should request to /whatever.
**Environment:**
- Axios Version [the current master]
**Additional context/Screenshots**
See https://github.com/axios/axios/pull/2656#issuecomment-598269460. | https://github.com/axios/axios/issues/2819 | https://github.com/axios/axios/pull/2844 | 487941663b791a4a5273d456aab24c6ddd10eb0e | 0d69a79c81a475f1cca6d83d824eed1e5b0b045d | "2020-03-13T02:13:21Z" | javascript | "2020-06-08T18:52:45Z" |
closed | axios/axios | https://github.com/axios/axios | 2,691 | ["lib/adapters/http.js", "package.json"] | Let's establish a closer relation with follow-redirects | Hi axios maintainers,
I'm the maintainer of follow-redirects. According to npm numbers (https://www.npmjs.com/package/axios, https://www.npmjs.com/package/follow-redirects), more than half of follow-redirects usage goes via axios. That is also apparent from several [bug reports](https://github.com/follow-redirects/follow-redirects/issues?q=axios) I received (and which I'm very happy about).
So if there are issues such as https://github.com/axios/axios/pull/1993 or https://github.com/axios/axios/pull/2689, it's probably best to ping us about it at https://github.com/follow-redirects/follow-redirects/issues/new. I'm very happy to fix. Pinning to an old version of follow-redirects will just expose you to bugs.
Please let me know how I can help.
CC: @grumblerchester @emilyemorehouse @realityking @chinesedfan | https://github.com/axios/axios/issues/2691 | https://github.com/axios/axios/pull/2689 | 77f0ae4f61e04ec5982eba171b1b7bb0b94569b7 | 56b72bbd2c2924ff6d89a7004282142d86ead8fa | "2020-01-25T22:01:37Z" | javascript | "2020-02-15T05:41:08Z" |
closed | axios/axios | https://github.com/axios/axios | 2,665 | ["lib/adapters/http.js"] | [Bug] Axios crashes on HEAD method and gziped repsonse | **To Reproduce**
Code snippet to reproduce, ideally that will work by pasting into something like https://npm.runkit.com/axios, a hosted solution, or a repository that illustrates the issue.
```js
const axios = require("axios")
const url = 'https://stackoverflow.com/questions';
const {headers} = await axios.head(url, {
headers: {'accept-encoding': 'gzip, deflate, br'}
});
```
You can run this in one click here https://runkit.com/embed/eocb5097ds6r
**Expected behavior**
Don't crush
**Environment:**
- Node.js any version
**Solution:**
It require trivial fix similar to https://github.com/axios/axios/pull/1129 | https://github.com/axios/axios/issues/2665 | https://github.com/axios/axios/pull/2666 | 2034c1db7eaac61fabd4319af2e9b4478d1d6b52 | 12e00b8018ddfb078800ebc548879723665b4bce | "2020-01-15T08:59:43Z" | javascript | "2020-02-15T10:10:58Z" |
closed | axios/axios | https://github.com/axios/axios | 2,646 | ["lib/helpers/isURLSameOrigin.js", "lib/helpers/isValidXss.js", "test/specs/helpers/isURLSameOrigin.spec.js", "test/specs/helpers/isValidXss.spec.js"] | Requests to urls containing 'javascript' are failing | It seems that axios v0.19.1 introduced a new bug.
The bug comes from https://github.com/axios/axios/pull/2464
All urls containing `javascript`keyword is throwing XSS error. So, all following urls cannot be used in axios any more:
- https://www.javascript.com
- https://stackoverflow.com/questions/tagged/javascript
- https://www.google.com/search?q=javascript
Here is a link to regexp: https://regexr.com/4rsst
Expected behavior: axios should accept `javascript` in urls | https://github.com/axios/axios/issues/2646 | https://github.com/axios/axios/pull/2679 | 351cf290f0478d6e47e74c6da2f3ad8fe8f29887 | c7488c7dd5ea697facc96202417cd1c4363a4ee7 | "2020-01-09T09:00:07Z" | javascript | "2020-01-20T16:20:33Z" |
closed | axios/axios | https://github.com/axios/axios | 2,594 | ["test/unit/adapters/http.js"] | Unit test fails when excuting the unit test in Windows OS | **Describe the bug**
Unit test case failed :
1) supports http with nodejs
should pass errors for a failed stream:
Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (***************...
**To Reproduce**
Use VS Code internal terminal to excute the unit test .
**Expected behavior**
UT should be excuted correctly.
**Environment:**
- Axios Version: latest master
- OS Version: Window 10
**Additional context/Screenshots**

| https://github.com/axios/axios/issues/2594 | https://github.com/axios/axios/pull/2601 | 12e00b8018ddfb078800ebc548879723665b4bce | 9267d4def1a3c65b2d2bbb051b11d74f25ea00ae | "2019-12-09T12:40:14Z" | javascript | "2020-02-15T11:03:34Z" |
closed | axios/axios | https://github.com/axios/axios | 2,468 | ["lib/core/Axios.js", "test/specs/api.spec.js", "test/specs/instance.spec.js"] | axios.getUri doesn't use baseURL | **Describe the bug**
When using https://github.com/axios/axios/pull/1712 example and adding baseURL in config, baseURL seems to not be used.
**To Reproduce**
```js
const axios = require("axios");
const fakeConfig = {
method: "post",
url: "/user/12345",
baseURL: "/foo"
};
console.log(axios.getUri(fakeConfig));
```
**Expected behavior**
`axios.getUri` should return `/foo/user/12345`.
If this expected behavior seems right, I can work on a fix.
**Environment:**
- Axios Version: 0.19.0
- OS: Linux, Windows
- Browser Chrome but also happen on Firefox and node | https://github.com/axios/axios/issues/2468 | https://github.com/axios/axios/pull/3737 | 195c8e5ff5af6506e5c3e9423cd3c6e839b9cc86 | bdb7d76d40407443dceaf9efa5d5a01ee4ef4da5 | "2019-10-15T16:20:17Z" | javascript | "2022-03-07T18:09:23Z" |
closed | axios/axios | https://github.com/axios/axios | 2,416 | ["lib/core/settle.js", "test/specs/requests.spec.js"] | Getting local files (file://) fail after upgrading from 0.18.0 to 0.19.0 | **Describe the bug**
When using axios to get a local file (`file://...`) I get status code 0 as if there's a CORS issue. This didn't happen using version 0.18.0 so I assume that this is a bug?
**To Reproduce**
Get a local file. In my case I wanted to get a PDF as an array buffer.
```js
axios("file://...", {
responseType: 'arraybuffer'
headers: {
Accept: 'application/pdf'
}
}).then(..)
```
**Expected behavior**
Just like in version 0.18.0 version I should get a 200 response.
**Environment:**
- Axios Version 0.19.0
- OS: Windows 10
- Browser: EO Webbrowser (Chromium)
- Browser Version: 19.1.95 (Chromium ~70)
- Additional Library Versions: React 16.8.6
**Additional context/Screenshots**
Need to build and run index.html locally so you're making the request from file:// as well. | https://github.com/axios/axios/issues/2416 | https://github.com/axios/axios/pull/2470 | 5189afff38dc0689ac0c1b1bfa51626bb8541709 | 885ada6d9b87801a57fe1d19f57304c315703079 | "2019-09-16T15:53:56Z" | javascript | "2020-03-23T13:49:38Z" |
closed | axios/axios | https://github.com/axios/axios | 2,396 | ["lib/core/settle.js", "test/specs/requests.spec.js"] | Regression in 0.19.0: file:/// that always returns a status code 0 now returns an error | **Describe the bug**
Since I upgrade axios from 0.18.0 to 0.19.0, the requests made to fetch a local file (`file:///`) with a relative path return an error: ```Request failed with status code 0```. However the web browser will always return a status code 0 when the request success because there is no HTTP server involved. The XHR readyState is also 4, if there was a network error, I believe this one would probably be 0 as well.
**To Reproduce**
```js
// In a HTML file like opened at file:///tmp/axios.html for example
axios.get('./file.ttf', {
responseType: 'arraybuffer',
}).then((resp) => {
console.log('OK', resp);
}).catch((err) => {
if (err.request && err.request.readyState === 4) {
// The response here should not be treated as an error
}
console.log('ERR', err);
});
```
**Expected behavior**
The request should success and return the arraybuffer (works with axios 0.18.0).
**Environment:**
- Axios Version: 0.19.0
- OS: iOS 12.4, OSX 10.14.6
- Browser: Safari
- Browser Version: 12.1.2
- Additional Library Versions: None
**Additional context/Screenshots**


| https://github.com/axios/axios/issues/2396 | https://github.com/axios/axios/pull/2470 | 5189afff38dc0689ac0c1b1bfa51626bb8541709 | 885ada6d9b87801a57fe1d19f57304c315703079 | "2019-09-07T11:33:13Z" | javascript | "2020-03-23T13:49:38Z" |
closed | axios/axios | https://github.com/axios/axios | 2,385 | [".travis.yml"] | Fix "Can't open /etc/init.d/xvfb" on travis. | <!-- Click "Preview" for a more readable version --
Please read and follow the instructions before submitting an issue:
- Read all our documentation, especially the [README](https://github.com/axios/axios/blob/master/README.md). It may contain information that helps you solve your issue.
- Ensure your issue isn't already [reported](https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=is%3Aissue).
- If you aren't sure that the issue is caused by Axios or you just need help, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/axios) or [our chat](https://gitter.im/mzabriskie/axios).
- If you're reporting a bug, ensure it isn't already fixed in the latest Axios version.
⚠️👆 Feel free to these instructions before submitting the issue 👆⚠️
-->
**Describe the bug**
Error on run travis Ci Build "Can't open /etc/init.d/xvfb"
**To Reproduce**
Re-run last build
**Expected behavior**
Build run's without problem.
**Additional context/Screenshots**

| https://github.com/axios/axios/issues/2385 | https://github.com/axios/axios/pull/2386 | 2ee3b482456cd2a09ccbd3a4b0c20f3d0c5a5644 | 98e4acd893fe024ae9e6074894c6164802b3af63 | "2019-09-02T00:46:50Z" | javascript | "2019-09-05T01:02:01Z" |
closed | axios/axios | https://github.com/axios/axios | 2,226 | ["README.md"] | axios commonjs correct way to import to gain typings? [vscode intellisense] | **Describe the issue**
what is the correct way to import `axios` in node using CommonJS in order to use the typings? i am not using typescript unlike [this issue](https://github.com/axios/axios/issues/1975)
**Example Code**
```js
const axios = require('axios'); // no typings but everything still works
const axios = require('axios').default; // has typings and everything works
```
**Expected behavior, if applicable**
i expected to have typings for vscode intellisense when importing `axios` using CommonJS `require()` syntax described in the documentation.
i did not see any information about having to append `.default` to the import. maybe worth including this in the docs? for the record the import still works (`axios.get()` etc) but there is no typing intellisense.
**Environment:**
- Axios Version: 0.19.0
- OS: OSX 10.14.5
- node: 10.15.3
- vscode: 1.34.0
**Additional context/Screenshots**
Add any other context about the problem here. If applicable, add screenshots to help explain.
**basic import**
<img width="746" alt="Screen Shot 2019-06-13 at 12 29 23 AM" src="https://user-images.githubusercontent.com/25523682/59403834-61e9a100-8d72-11e9-9c53-0dd50a14e38e.png">
**import with `.default`**
<img width="747" alt="Screen Shot 2019-06-13 at 12 29 34 AM" src="https://user-images.githubusercontent.com/25523682/59403848-68781880-8d72-11e9-8d96-c8acabd56a2b.png">
| https://github.com/axios/axios/issues/2226 | https://github.com/axios/axios/pull/2256 | 488a4598a3eedc5bf99a6df0bbd07d1cbd8bb1a4 | e3a7116f14e7bbb7c3645df5d7910642c8fc2f5e | "2019-06-13T04:35:43Z" | javascript | "2019-09-13T12:28:14Z" |
closed | axios/axios | https://github.com/axios/axios | 2,203 | ["lib/core/mergeConfig.js", "test/specs/core/mergeConfig.spec.js"] | Custom properties for config | So, if I understand it right, in 0.19.0 you've added `mergeConfig`
And this function filter config and remove custom properties from it.
It broke my solution for cancellation:
How it works:
```js
const requestManager = new RequestManager();
const instance = axios.create();
requestManager.patchAxiosInstance(instance);
const search = q =>
instance.get('/search', {
cancelable: true, // this is no longer possible in 0.19.0
params: { q },
});
```

The solution:
```js
class RequestManager {
constructor() {
this.pendingRequests = new Map();
}
patchAxiosInstance(instance) {
instance.interceptors.request.use(config => {
if (!config.cancelable) return config; // this is no longer possible in 0.19.0
const source = axios.CancelToken.source();
const requestId = `${config.method}_${config.url}`;
const cancelToken = source.token;
this.addRequest(requestId, source.cancel);
return { ...config, cancelToken, requestId };
});
instance.interceptors.response.use(response => {
const { requestId } = response.config; // this is no longer possible in 0.19.0
if (requestId) {
this.removeRequest(requestId);
}
return response;
});
}
addRequest(requestId, cancelFn) {
this.cancelRequest(requestId);
this.pendingRequests.set(requestId, cancelFn);
}
removeRequest(requestId) {
this.pendingRequests.delete(requestId);
}
cancelRequest(requestId) {
if (this.pendingRequests.has(requestId)) {
const cancelFn = this.pendingRequests.get(requestId);
cancelFn();
this.removeRequest(requestId);
}
}
}
```
So, is it possible to relax filter in `mergeConfig` for custom properties? Because sometimes it is needed and very helpful in interceptors or somewhere else. | https://github.com/axios/axios/issues/2203 | https://github.com/axios/axios/pull/2207 | e50a08b2c392c6ce3b5a9dc85ebc860d50414529 | a11cdf468303a365a6dc6e84f6dd0e4b3b8fd336 | "2019-06-05T13:43:07Z" | javascript | "2019-09-07T00:40:04Z" |
closed | axios/axios | https://github.com/axios/axios | 2,195 | ["lib/defaults.js"] | 0.19.0 no longer works with xhr-mock | **Describe the bug**
Running Jest unit tests with xhr-mock https://github.com/jameslnewell/xhr-mock fail. Reverting to 0.18.0 fixed it. | https://github.com/axios/axios/issues/2195 | https://github.com/axios/axios/pull/2201 | c454e9f526bad399bd2a92af7fa8bc97a6d1acd0 | 1b07fb9365d38a1a8ce7427130bf9db8101daf09 | "2019-05-31T15:45:18Z" | javascript | "2019-09-13T12:35:59Z" |
closed | axios/axios | https://github.com/axios/axios | 2,158 | ["README.md"] | Clarification: Only Basic auth | **Section/Content To Improve**
[Request Config](https://github.com/axios/axios#request-config)
**Suggested Improvement**
On the 'auth' option are said:
> `auth` indicates that HTTP Basic auth should be used, and supplies credentials.
> This will set an `Authorization` header, overwriting any existing
> `Authorization` custom headers you have set using `headers`.
I think that need more clarification that bearer token auth, for example, will don't work | https://github.com/axios/axios/issues/2158 | https://github.com/axios/axios/pull/2166 | 5250e6e168f22bf75f0643b21577ac7c4dc486b9 | f28ff933e491ad7b1dd77af6ad3abe126109bd9e | "2019-05-17T03:04:37Z" | javascript | "2019-05-28T16:57:59Z" |
closed | axios/axios | https://github.com/axios/axios | 2,153 | ["README.md", "index.d.ts", "lib/adapters/http.js", "test/unit/adapters/http.js"] | Add option to not auto decompress resp | **Is your feature request related to a problem? Please describe.**
It's frustrating there's no option to turn off decompress. There are situations where you want to do this. Ex: having a service that collects data, but doesn't analyze it. which then passes to another service immediately/eventually.
While data is waiting or in traffic to next stop, it should stay compressed. The difference in byte size is huge (for me, 60MB vs 1-2MB).
**Describe the solution you'd like**
Add an option to the request to not automatically decompress for me. I'm a big boy, I can handle it myself later.
**Describe alternatives you've considered**
There are none except user another lib or write own http req (which is ridiculous just to turn off a auto feature).
I can submit a PR if no one else wants to do it (it's not hard to add). But let me know how you'd like the option to be passed in? An extra options key? `axios({ url: ..., method: ..., decompress: false })` , or adding option to an existing option?
| https://github.com/axios/axios/issues/2153 | https://github.com/axios/axios/pull/2661 | 6642ca9aa1efae47b1a9d3ce3adc98416318661c | 42eb9dfabc85ed029462da1c503f8b414b08ffd0 | "2019-05-14T15:35:37Z" | javascript | "2020-03-06T14:01:58Z" |
closed | axios/axios | https://github.com/axios/axios | 2,103 | ["lib/adapters/xhr.js"] | Error: timeout of 0ms exceeded | Sentry reported a random error coming from Axios, `Error: timeout of 0ms exceeded`.
Under what circumstances would this error appear? We don't have timeout settings configured, and 0ms seems like a mighty short time for any request to finish, so why is this error thrown?
It appears to have been a one off that is not readily reproducible, so I can't provide test code, but the underlying network error seems to have been `ECONNABORTED`.
Axios version 0.18.0
| https://github.com/axios/axios/issues/2103 | https://github.com/axios/axios/pull/3209 | e52cd3ac6439237414a17ab6f37d8a50df6d989b | 96956e30ba2768b754d53125af832c9ccf66a9cd | "2019-04-20T21:23:45Z" | javascript | "2021-09-16T19:16:43Z" |
closed | axios/axios | https://github.com/axios/axios | 1,990 | ["test/typescript/axios.ts"] | interface AxiosInstance is missing 'options' method | ```typescript
export interface AxiosInstance {
(config: AxiosRequestConfig): AxiosPromise;
(url: string, config?: AxiosRequestConfig): AxiosPromise;
defaults: AxiosRequestConfig;
interceptors: {
request: AxiosInterceptorManager<AxiosRequestConfig>;
response: AxiosInterceptorManager<AxiosResponse>;
};
request<T = any>(config: AxiosRequestConfig): AxiosPromise<T>;
get<T = any>(url: string, config?: AxiosRequestConfig): AxiosPromise<T>;
delete(url: string, config?: AxiosRequestConfig): AxiosPromise;
head(url: string, config?: AxiosRequestConfig): AxiosPromise;
post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): AxiosPromise<T>;
put<T = any>(url: string, data?: any, config?: AxiosRequestConfig): AxiosPromise<T>;
patch<T = any>(url: string, data?: any, config?: AxiosRequestConfig): AxiosPromise<T>;
}
```
This is missing a line which should be
`options(url: string, config?: AxiosRequestConfig): AxiosPromise;`
| https://github.com/axios/axios/issues/1990 | https://github.com/axios/axios/pull/1996 | 42eb9dfabc85ed029462da1c503f8b414b08ffd0 | c98ce7d464488dd59a6987cfaf08a4c7b31b96a2 | "2019-02-06T15:50:54Z" | javascript | "2020-03-07T06:10:34Z" |
closed | axios/axios | https://github.com/axios/axios | 1,953 | ["package.json"] | `should support max redirects` mocha test fails | Seems like the `should support max redirect` mocha test is failing right away.
The checks are done in follow-redirects dep. that has been updated 6 days ago. Might have something to do with that maybe? See recent [commits](https://github.com/follow-redirects/follow-redirects/commits/master) to follow-redirects | https://github.com/axios/axios/issues/1953 | https://github.com/axios/axios/pull/1993 | e122c80c9ddb17e4dad2b6225da2ed9e95e986c7 | 2eeb59af4de41e07c7dd1eec09af0230960c029c | "2019-01-09T07:27:10Z" | javascript | "2019-02-09T04:27:36Z" |
closed | axios/axios | https://github.com/axios/axios | 1,828 | ["package-lock.json"] | Request defaults |
#### Summary
There is no way of knowing the defaults of request , i've searched `baseURL` default everywhere in the code and there is no way of knowing that, it is also does not mentioned in the Docs or COOKBOOK.
from sending a relative request i see that the baseURL is 127.0.0.1 but from where `axios` retrieve that information ? and how does it build the `url` assuming i did not passed a `config` when creating a axios instance?
#### Context
- axios version: 0.18.0
- Environment: node : v8.10.0 Ubuntu 16.04
| https://github.com/axios/axios/issues/1828 | https://github.com/axios/axios/pull/4615 | 008dd9d466167e97727bdba13f4937bb9d7f3baa | f94dda9c76442ac097923fdfc02199e72c20f083 | "2018-10-14T15:26:50Z" | javascript | "2022-04-25T06:04:07Z" |
closed | axios/axios | https://github.com/axios/axios | 1,788 | [".eslintrc.js"] | .eslintrc without extension is deprecated | #### Summary
.eslintrc without extension is deprecated (https://eslint.org/docs/user-guide/configuring#configuration-file-formats).
Though it is not a critical situation, add the extension will prevent a future development warning in case linters decide ti drop support to .eslintrc without extension.
To fix it, I suggest change the content to a js module (to allow comments). No other change is required.
#### Context
All
| https://github.com/axios/axios/issues/1788 | https://github.com/axios/axios/pull/1789 | a74ab87df22a04932bcb1cc91d05dd0b2fa4ae9e | 81f0d28eb5f8f3ec606fe0e282d4fbaea109c868 | "2018-09-13T12:10:28Z" | javascript | "2018-09-17T14:24:46Z" |
closed | axios/axios | https://github.com/axios/axios | 1,656 | ["karma.conf.js", "lib/adapters/xhr.js", "lib/core/settle.js", "lib/helpers/btoa.js", "test/specs/__helpers.js", "test/specs/basicAuth.spec.js", "test/specs/basicAuthWithPolyfill.spec.js", "test/specs/helpers/btoa.spec.js", "test/specs/requests.spec.js", "test/specs/utils/isX.spec.js"] | Dropping support for IE9 | So this is a little self serving, but I think we should consider dropping support for IE9. The data is interesting. I'm seeing a [0.6% browser market share for IE9](https://netmarketshare.com/browser-market-share.aspx?options=%7B%22filter%22%3A%7B%22%24and%22%3A%5B%7B%22deviceType%22%3A%7B%22%24in%22%3A%5B%22Desktop%2Flaptop%22%5D%7D%7D%5D%7D%2C%22dateLabel%22%3A%22Trend%22%2C%22attributes%22%3A%22share%22%2C%22group%22%3A%22browserVersion%22%2C%22sort%22%3A%7B%22share%22%3A-1%7D%2C%22id%22%3A%22browsersDesktopVersions%22%2C%22dateInterval%22%3A%22Monthly%22%2C%22dateStart%22%3A%222017-07%22%2C%22dateEnd%22%3A%222018-06%22%2C%22segments%22%3A%22-1000%22%2C%22pageLength%22%3A50%7D).
What's neat about that data is that IE8 has twice the usage of IE9 🤷♂️ And IE10 has only 0.54% market share! I could make a reasonable argument for dropping both IE9 *and* IE10.
Of course, I'm only looking at this because I'd very much like to ship a new npm module with a few recently merged changes, and the IE9 tests are failing :)
What are folks thoughts? Does anyone feel strongly about the IE support matrix as it stands today?
@nickuraltsev @mzabriskie | https://github.com/axios/axios/issues/1656 | https://github.com/axios/axios/pull/1689 | 33747ee8fb349a59368f62c9415664d53c84baf4 | 503418718f669fcc674719fd862b355605d7b41f | "2018-07-06T06:15:49Z" | javascript | "2018-08-06T07:56:51Z" |
closed | axios/axios | https://github.com/axios/axios | 1,643 | ["lib/adapters/xhr.js"] | Axios overwrite Content-Type when sending a blob/file with type. | Here is the error case: <https://codepen.io/Gerhut/pen/OErpQm?editors=0012>
Browsers will set Content-Type header automatically from `Blob#type` or `File#type` (if exists) when sending a Blob/File through xhr, which is overwritten by `axios.defaults.headers.post`.
Shall we provide a specific behavior about this case, either remove the `Content-Type` and let it be set by the browser (like FormData) or set it as `Blob#type` or `File#type` manually to increase compatibility? (Although I don't know if there is any browser don't set `Blob#type` or `File#type` in xhr.)
| https://github.com/axios/axios/issues/1643 | https://github.com/axios/axios/pull/1773 | f2b478f7ffc4136334ceddf4e4cf9011c380f0bf | f3cc053fb9feda2c3d5a27513f16e6722a0f9737 | "2018-06-29T10:52:49Z" | javascript | "2020-05-28T19:28:40Z" |
closed | axios/axios | https://github.com/axios/axios | 1,606 | ["README.md"] | get header in GET request with a specific name | <!-- Click "Preview" for a more readable version -->
#### Summary
Hello
i am using axios for a get request and in the response's header there is a key like this:
x-pagination-total-count
i tried to get the value of this key by 'result.headers.x-pagination-total-count' and the result is undefined for this line of code.
how should i get this header?
#### Context
- axios version: *e.g.: v0.16.0*
- Environment: *e.g.: node v6.9.4, chrome 54, windows 7*
| https://github.com/axios/axios/issues/1606 | https://github.com/axios/axios/pull/1901 | b139abfc36d741b8a9075efed73e6df340175e9a | 67e560da102916195cd06776d4090b1ec90426a6 | "2018-06-14T11:48:08Z" | javascript | "2020-02-26T11:03:20Z" |
closed | axios/axios | https://github.com/axios/axios | 1,561 | ["lib/core/mergeConfig.js"] | charset latin1 not working | #### Summary
I can not make charset work. I am making request for a page that deals with `charset=iso-8859-1`, and even setting `{ charset: 'latin1' }`, correct decoding does not happen.
I'm following this https://github.com/axios/axios/pull/869
I've tried `latin1` and `latin-1`
```javascript
// url to open bases results
const url = `http://www.stf.jus.br/portal/jurisprudencia/listarJurisprudencia.asp?s1=%28SAUDE+COMPLEMENTAR%29&base=baseAcordaos&url=http://tinyurl.com/y9e68odp`
// request first page
axios.get(url, {}, { charset: 'latin-1' })
.then(({ data }) => {
console.log(data)
})
```
#### Context
- axios version: *v0.18.0*
- Environment: *node v10.1.0*
Thank you
| https://github.com/axios/axios/issues/1561 | https://github.com/axios/axios/pull/1745 | 2cf6ae460899d944553fbfd66800cdcb5cd871aa | 17a967123cc1c06f15146a463b99816d4ca5f2b2 | "2018-05-24T22:59:31Z" | javascript | "2020-02-15T13:49:26Z" |
closed | axios/axios | https://github.com/axios/axios | 1,451 | ["README.md"] | Some confusion in README: Config order of precedence | <!-- Click "Preview" for a more readable version -->
#### Summary
From the README:
```js
// Create an instance using the config defaults provided by the library
// At this point the timeout config value is `0` as is the default for the library
var instance = axios.create();
// Override timeout default for the library
// Now all requests will wait 2.5 seconds before timing out
instance.defaults.timeout = 2500;
// Override timeout for this request as it's known to take a long time
instance.get('/longRequest', {
timeout: 5000
});
```
Shouldn't that change the `timeout` only for that single created instance and not for all requests?
Probably this should read:
```
// Now all requests FOR THIS INSTANCE will wait 2.5 seconds before timing out
```
To change the `timeout` for ALL request I'd expect to have to do something like:
```js
axios.defaults.timeout = 2500;
```
Maybe the README is wrong... | https://github.com/axios/axios/issues/1451 | https://github.com/axios/axios/pull/1456 | 9a6abd789f91a87d701116c0d86f1cfbc3295d66 | e990a91c34bd81a5cb9261c7a0284dfd8169c0ae | "2018-04-04T14:17:49Z" | javascript | "2018-04-06T19:37:38Z" |
closed | axios/axios | https://github.com/axios/axios | 1,431 | ["README.md"] | explicit maxContentLength unit information missing | > // `maxContentLength` defines the max size of the http response content allowed
> maxContentLength: 2000,
Is it bytes we are talking here about?
| https://github.com/axios/axios/issues/1431 | https://github.com/axios/axios/pull/1463 | ae1c2c30061f6c8d90c43cee3ea906f3151d0de8 | 7b11cc7181b4536233299efe98c6e7779d13e95e | "2018-03-19T13:50:50Z" | javascript | "2018-04-08T07:18:30Z" |
closed | axios/axios | https://github.com/axios/axios | 1,415 | ["index.d.ts", "lib/core/enhanceError.js", "test/specs/core/createError.spec.js", "test/specs/core/enhanceError.spec.js"] | AxiosError type for javascript | #### Summary
Axios rejects error with Error type. Adding custom error type will help with distinguishing between axios and other errors. The only way now is to check 'request' field existence which is not always possible. Our internal custom error type has this field too.
#### Example:
``` js
const { axios, AxiosError } = require('axios');
...
try {
...
const response = await axios.get(url);
...
} catch (error) {
if(error instanceof AxiosError) {
return processAxiosError(error);
}
throw error;
}
```
#### Context
- axios version: 0.18.0
Relates to: #24 | https://github.com/axios/axios/issues/1415 | https://github.com/axios/axios/pull/1419 | c0b40650d1c61d1e61c7853de806deeb3cb8ad12 | b681e919c40fbf7abd109d0cb4f0caf2fd5553e5 | "2018-03-14T10:11:28Z" | javascript | "2018-08-20T09:02:23Z" |
closed | axios/axios | https://github.com/axios/axios | 1,345 | ["lib/core/Axios.js", "lib/core/dispatchRequest.js", "lib/core/mergeConfig.js", "lib/utils.js", "test/specs/core/mergeConfig.spec.js", "test/specs/headers.spec.js", "test/specs/requests.spec.js", "test/specs/utils/deepMerge.spec.js", "test/specs/utils/isX.spec.js", "test/specs/utils/merge.spec.js"] | Bug with transformResponse and transformRequest functions/arrays/objects | ### Summary
tl;dr `utils.merge` break `transformResponse` and `transformRequest` behaviour in certain scenarios.
There are 3 parts of the problem.
#### Inconsistency between types in configs when setting `transform*` directly via `axiosInstance.defaults.transform*` and using `axios.create(config)`
The problem is that when setting directly one would set it as e.g. `axios.defaults.transformRequest = [f1, f2, f3]` but when passing the same _array_ via config it will get mergeda and become `{0: ƒ, 1: ƒ, 2: ƒ}`
```javascript
axios.create = function create (instanceConfig) {
return createInstance(utils.merge(defaults, instanceConfig))
}
```
and the `merge` function forces the array to become an `Object` with numbers converted to strings as keys.
That of course breaks a quite simple situation showed even in [examples/transform-response/index.html](https://github.com/axios/axios/blob/master/examples/transform-response/index.html)
```javascript
transformResponse: axios.defaults.transformResponse.concat(function (data, headers) {
```
Theoretically it still works as we can access this object via `[number]` but it seems as not quite expected behaviour.
Additionality when using typescript `transformResponse?: AxiosTransformer | AxiosTransformer[];` becomes very not true ;) and even can be a big problem when using a type guard `if (transformResponse instanceof Array) {`
#### Wrong behavior when merging `defaults` with per request `config`
Because of the merge method and the array becoming an Object we might encounter a totally unexpected behaviour when using `axios.get('url', { transformResponse: mySpecialOneTimeTransform });`
```
a = ['1', '2']
b = ['3']
utils.merge(a,b)
{0: "3", 1: "2"}
```
IMO that is the least expected behaviour when passing config to single request.
And that brings us to the last problem.
#### The _by design_ problem
1. When creating an axios instance - should the transforms be merged or overwritten.
2. When passing a config per request - should the transforms be merged or overwritten.
* merging - then there is no possibility to exceptionally not apply the default transforms [bad idea], also we should at least keep the order
* overwriting - that's kinda ok, we could then add a new transform by taking the defaults and `concat` a new transformer(as shown in example)
* adding new api methods to transform* for adding and removing functions (that's becoming weirdly similar to interceptors)
3. Do we really need to have `AxiosTransformer | AxiosTransformer[]` i suppose allowing only an array would be better. (That could be a breaking change, but probably acceptable as we are expecting release 1.0)
This issue is strongly connected with #1109 and might be connected with multiple defaults and config issues from the checklist in #1333.
Possibly quite a lot of this will be solved when checklist item `Substitute custom utils with lodash` is finished.
#### Context
- axios version: *e.g.: v0.17.1*
- Environment: *e.g.: node v8.9.3, windows 10*
| https://github.com/axios/axios/issues/1345 | https://github.com/axios/axios/pull/2844 | 487941663b791a4a5273d456aab24c6ddd10eb0e | 0d69a79c81a475f1cca6d83d824eed1e5b0b045d | "2018-02-07T21:07:30Z" | javascript | "2020-06-08T18:52:45Z" |
closed | axios/axios | https://github.com/axios/axios | 1,309 | ["package-lock.json"] | Failed to load http://js.filatov-nikita.ru/api/products.php: Request header field X-Requested-With is not allowed by Access-Control-Allow-Headers in preflight response. | I use laravel and vue with axios for sending request. And i get this error Request header field Access-Control-Allow-Origin is not allowed by Access-Control-Allow-Headers in preflight response. import Axios from 'axios';
Vue.prototype.$http = Axios.create({
baseURL: 'http://js.filatov-nikita.ru/api/',
crossDomain:true,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}); | https://github.com/axios/axios/issues/1309 | https://github.com/axios/axios/pull/5294 | 3a7c363e540e388481346e0c0a3c80e8318dbf5d | e1989e91de13f2d6cd6732745ae64dbc41e288de | "2018-01-21T13:55:44Z" | javascript | "2022-11-22T17:56:32Z" |
closed | axios/axios | https://github.com/axios/axios | 1,252 | ["lib/core/dispatchRequest.js", "test/specs/headers.spec.js"] | Strange behavior when header name matches HTTP request method | #### Summary
Axios appears to treat headers names that correspond to lowercase HTTP methods incorrectly.
If the header name matches the current HTTP method, the header name is transformed to `0`:
```js
axios.post('http://localhost:8888/', null, {headers: {'post': 'test'}});
```
```
POST / HTTP/1.1
0: test
Accept: application/json, text/plain, */*
Get: test
User-Agent: axios/0.17.1
Host: localhost:8888
Connection: close
Content-Length: 0
```
If the header name matches a different HTTP method, it is removed:
```js
axios.post('http://localhost:8888/', null, {headers: {'get': 'test'}});
```
```
POST / HTTP/1.1
Accept: application/json, text/plain, */*
Content-Type: application/x-www-form-urlencoded
User-Agent: axios/0.17.1
Host: localhost:8888
Connection: close
Content-Length: 0
```
This only seems to happen when the header name is lowercase-a header named `Get` is handled correctly:
```
axios.post('http://localhost:8888/', null, {headers: {'Get': 'test'}});
```
```
POST / HTTP/1.1
Accept: application/json, text/plain, */*
Content-Type: application/x-www-form-urlencoded
Get: test
User-Agent: axios/0.17.1
Host: localhost:8888
Connection: close
Content-Length: 0
```
I didn't see anything in the docs about special meaning for these header names when passed directly. `axios.defaults.headers` has keys that correspond to HTTP methods, but it doesn't seem to make sense to interpret the headers set directly in the same way.
#### Context
- axios version: 0.17.1
- Environment: node v8.9.1
| https://github.com/axios/axios/issues/1252 | https://github.com/axios/axios/pull/1258 | 1cdf9e4039ede6dd5e033112f3ff6bbaffb66970 | 920510b3a6fecdeb2ba2eb472b0de77ec3cbdd06 | "2017-12-20T17:26:26Z" | javascript | "2020-05-22T19:26:10Z" |
closed | axios/axios | https://github.com/axios/axios | 1,158 | ["lib/adapters/http.js", "test/unit/adapters/http.js"] | Request method changed on redirect | Hi,
I'm using axios v0.17.0 with HEAD method like this:
`axios.head('http://example.com'); `
(let's suppose http://example.com is set to redirect 301 to http://www.example.com)
For some reason Request method will change on the first redirect to GET instead of keeping HEAD all the way down. This will read in logs like this:
```
example.com:80 10.0.0.1 - - "HEAD / HTTP/1.1" 301 237 "-" "axios/0.17.0"
example.com:80 10.0.0.1 - - "GET / HTTP/1.1" 200 246 "-" "axios/0.17.0"
```
instead of this:
```
example.com:80 10.0.0.1 - - "HEAD / HTTP/1.1" 301 237 "-" "axios/0.17.0"
example.com:80 10.0.0.1 - - "HEAD / HTTP/1.1" 200 246 "-" "axios/0.17.0"
```
When I do the test in Firefox it keeps original request method (HEAD) all the way down.
Any idea why is this?
Thanks,
Milos
| https://github.com/axios/axios/issues/1158 | https://github.com/axios/axios/pull/1758 | 9005a54a8b42be41ca49a31dcfda915d1a91c388 | 21ae22dbd3ae3d3a55d9efd4eead3dd7fb6d8e6e | "2017-11-02T14:01:29Z" | javascript | "2018-08-27T15:26:38Z" |
closed | axios/axios | https://github.com/axios/axios | 1,100 | ["ECOSYSTEM.md"] | redux-saga-requests - Axios and Redux Saga | Hi, I just published new library [redux-saga-requests](https://github.com/klis87/redux-saga-requests), which simplifies AJAX requests. If you find it useful, we could add it to resources > ecosystem in axios docs. | https://github.com/axios/axios/issues/1100 | https://github.com/axios/axios/pull/1279 | 6e605016f03c59b5e0c9d2855deb3c5e6ec5bbfc | 138108ee56bd689305ae505a66b48d5e9c8aa494 | "2017-09-24T20:30:24Z" | javascript | "2018-01-11T05:09:16Z" |
closed | axios/axios | https://github.com/axios/axios | 1,077 | ["lib/core/Axios.js", "lib/core/dispatchRequest.js", "lib/core/mergeConfig.js", "lib/utils.js", "test/specs/core/mergeConfig.spec.js", "test/specs/headers.spec.js", "test/specs/requests.spec.js", "test/specs/utils/deepMerge.spec.js", "test/specs/utils/isX.spec.js", "test/specs/utils/merge.spec.js"] | utils.merge not considering/handling the prototype chain | #### Summary
Trying to use Axios on Node with your own http(s)Agent set via the global default triggers the error: `TypeError: self.agent.addRequest is not a function`
For minimal example see: https://runkit.com/rupesh/59b1bcc1efc2f800128b7d54
It seems to be related to utils.merge not considering/handling the prototype chain:
<img width="814" alt="developer_tools_-_node_js" src="https://user-images.githubusercontent.com/3313870/30188235-58af3bd8-9425-11e7-9f99-4bc01ff4bf96.png">
Stack trace:
```
TypeError: self.agent.addRequest is not a function
at new ClientRequest in core _http_client.js — line 160
at http.Agent in core http.js — line 31
at RedirectableRequest._performRequest in follow-redirects/index.js — line 73
at Writable.RedirectableRequest in follow-redirects/index.js — line 57
at wrappedProtocol.request in follow-redirects/index.js — line 229
at dispatchHttpRequest in axios/lib/adapters/http.js — line 131
at httpAdapter in axios/lib/adapters/http.js — line 18
```
#### Context
- axios version: 0.16.2
- Environment: node v4, 6, 7 and 8
| https://github.com/axios/axios/issues/1077 | https://github.com/axios/axios/pull/2844 | 487941663b791a4a5273d456aab24c6ddd10eb0e | 0d69a79c81a475f1cca6d83d824eed1e5b0b045d | "2017-09-07T22:37:44Z" | javascript | "2020-06-08T18:52:45Z" |
closed | axios/axios | https://github.com/axios/axios | 1,004 | ["lib/adapters/http.js"] | Axios waits for timeout (when configured) even if nock throws an error | #### Summary
When using nock and axios on the server side (node environment) to mock requests and responses, I ran into an interesting issue when I have axios configured with a timeout value.
If nock is not configured for a particular request, it throws an error: `Error: Nock: No match for request`.
If axios does NOT have a timeout value set, no thread is left open and hanging and the test suite closes as normal.
If a timeout value IS set, axios waits the entire duration of the timeout before closing. Whats weird is the promise axios returns is rejected by nock (which is how I found that error above) so I have no idea why axios stays open for the full timeout.
The issue is in test runners (specifically Jest) will remain open until all threads are done. With axios hanging open here, our test times ballooned without any visible reason and it took me several hours to trace it to this change that caused it.
I have a simple workaround, if in the test environment don't set a timeout value (or make sure we nock all requests) but it feels like a bug to me that the axios promise throws but yet it remains running.
#### Context
- axios version: *v0.16.2*
- nock version: *v9.0.13*
- jest version: *v20.0.4*
- Environment: *node v6.10.2*
| https://github.com/axios/axios/issues/1004 | https://github.com/axios/axios/pull/1040 | b14cdd842561b583b30b5bca5c209536c5cb8028 | 4fbf08467459845b0551dd60e3fd2086b1d19c4a | "2017-07-19T16:35:08Z" | javascript | "2018-03-08T17:35:58Z" |
closed | axios/axios | https://github.com/axios/axios | 949 | ["lib/core/Axios.js", "lib/core/dispatchRequest.js", "test/specs/interceptors.spec.js"] | Set baseURL in interceptors is not working. | <!-- Click "Preview" for a more readable version -->
#### Summary
set baseURL in interceptors is not working.
```
const service = axios.create({
baseURL: 'http://localhost/'
});
service.interceptors.request.use(config => {
config.baseURL = 'dd'
console.log(config.url) // output : http://localhost/././../
return config;
}, error => {
// Do something with request error
console.error(error); // for debug
Promise.reject(error);
})
```
#### Context
- axios version: *e.g.: v0.16.2*
- Environment: *e.g.: node vv8.0.0, chrome 59.0.3071.86, macOS 10.12*
| https://github.com/axios/axios/issues/949 | https://github.com/axios/axios/pull/950 | 6508280bbfa83a731a33aa99394f7f6cdeb0ea0b | 2b8562694ec4322392cb0cf0d27fe69bd290fcb2 | "2017-06-09T07:37:56Z" | javascript | "2017-08-12T12:15:27Z" |
closed | axios/axios | https://github.com/axios/axios | 846 | ["lib/adapters/http.js", "lib/utils.js", "package.json"] | Axios 0.16.1 adds buffer.js to the browser bundle, tripling its size | #### Summary
It looks like latest version includes `buffer.js` on the browser bundle even if not actually used.
This makes axios bundle size **3 times bigger**, adding 22kB to the minified size (0.16.0 is 11.9 KB while 0.16.1 is 33.9kB).
#### Context
- axios version: v0.16.1
| https://github.com/axios/axios/issues/846 | https://github.com/axios/axios/pull/887 | 1beb245f3a9cdc6da333c054ba5776a2697911dd | d1278dfe353d772c689a7884913a46f122538cd2 | "2017-04-18T09:46:43Z" | javascript | "2017-05-31T02:31:42Z" |
closed | axios/axios | https://github.com/axios/axios | 807 | [".github/workflows/stale.yml"] | CORS did't work on IE,header did't sent | My custom header sets well on chrome or safari, but when it works on IE(9), my custom header did't sent to the server,
No 'Content-Type' was sent to the server,
And 'Accept' was still '*/*',
the XHR was 415 error if the header did't set well,
there is no problem in other browser
`import "babel-polyfill";
import axios from 'axios/dist/axios.min' //"axios": "^0.15.3",
let baseUrl = 'http://192.168.51.********/';
const axiosInstance = axios.create({
baseURL: baseUrl,
timeout: 30000,
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
})
axiosInstance.interceptors.request.use(function (config) {
let temp = config.data;
config.data = {};
config.data.data = temp;
config.data.token = window.sessionStorage.getItem("token") || "";
return config;
})
export default axiosInstance;` | https://github.com/axios/axios/issues/807 | https://github.com/axios/axios/pull/4980 | 60e85533b3c38687b862d5a77bdf9614d1e3f6d0 | 659eeaf67cc0d54e86d0e38b90bd6f8174f56fca | "2017-03-31T03:37:11Z" | javascript | "2022-09-29T06:27:44Z" |
closed | axios/axios | https://github.com/axios/axios | 775 | [".github/workflows/stale.yml"] | How to reproduce the algorithm ON DUPLICATE KEY UPDATE? | I have a table with users options:
```
------------------------------------------------------
| id | option_id | option_value |
------------------------------------------------------
```
I want to update a row in a table with one command or create a new one if it does not already exist.
```mysql
INSERT INTO
options
SET
option_id = 'enabled',
value = 1
ON DUPLICATE KEY UPDATE
value = 1
```
How to achieve this result using Lucid or Query Builder? | https://github.com/axios/axios/issues/775 | https://github.com/axios/axios/pull/4980 | 60e85533b3c38687b862d5a77bdf9614d1e3f6d0 | 659eeaf67cc0d54e86d0e38b90bd6f8174f56fca | "2017-03-19T15:32:30Z" | javascript | "2022-09-29T06:27:44Z" |
closed | axios/axios | https://github.com/axios/axios | 768 | ["lib/adapters/http.js"] | Protocol "https:" not supported. Expected "http:" Error | ```
const agent = new http.Agent({family: 4});
axios.get("http://mywebsite.com", {
httpAgent: agent
})
.then((response) => {
console.log(response);
})
```
With above code, I get below error
http_client.js:55
throw new Error('Protocol "' + protocol + '" not supported. ' +
^
Error: Protocol "https:" not supported. Expected "http:"
at new ClientRequest (_http_client.js:55:11)
I am using Axios 0.15.3 and Node 6.10.0 version | https://github.com/axios/axios/issues/768 | https://github.com/axios/axios/pull/1904 | dc4bc49673943e35280e5df831f5c3d0347a9393 | 03e6f4bf4c1eced613cf60d59ef50b0e18b31907 | "2017-03-17T14:02:26Z" | javascript | "2019-12-25T20:55:36Z" |
closed | axios/axios | https://github.com/axios/axios | 744 | [".github/workflows/ci.yml"] | Axios not parsing JSON but instead returning all the markup on page using React & Redux | I have a local .json file that I am trying to fetch but instead all the markup for my page is being returned. I've scoured online looking for a solution, but coming up short.
flickrActions.js:
```
export const fetchFlickr = () => {
return function(dispatch, getState) {
axios.get("/data/output.json", {
headers: { 'Content-Type': 'application/json' }
})
.then((response) => {
dispatch({type: "FETCH_TWEETS_FULFILLED", payload: response.data})
})
.catch((err) => {
dispatch({type: "FETCH_TWEETS_REJECTED", payload: err})
})
}
}
```
output.json:
```
[
{
"code":"BAcyDyQwcXX",
"id":"1161022966406956503",
"display_src":"https://scontent.cdninstagram.com/hphotos-xap1/t51.2885-15/e35/12552326_495932673919321_1443393332_n.jpg"
},
{
"code":"BAcyDyQwcXX",
"id":"1161022966406956503",
"display_src":"https://scontent.cdninstagram.com/hphotos-xap1/t51.2885-15/e35/12552326_495932673919321_1443393332_n.jpg"
},
{
"code":"BAcyDyQwcXX",
"id":"1161022966406956503",
"display_src":"https://scontent.cdninstagram.com/hphotos-xap1/t51.2885-15/e35/12552326_495932673919321_1443393332_n.jpg"
}
]
```
What is being returned:
<img width="901" alt="screen shot 2017-03-08 at 7 46 01 am" src="https://cloud.githubusercontent.com/assets/1817084/23677524/97c55a46-03d4-11e7-9283-6ab76da33782.png">
| https://github.com/axios/axios/issues/744 | https://github.com/axios/axios/pull/4796 | 6ac313a01ee3c3daccd6d7f0f9b5005fb714c811 | de7f4c6c393acab30e27b5b35f3846518aabc28d | "2017-03-07T20:53:31Z" | javascript | "2022-06-18T09:11:11Z" |
closed | axios/axios | https://github.com/axios/axios | 728 | ["lib/utils.js"] | isStandardBrowserEnv not working properly | Hello we are using axios with react native and react-native-signalr lib.
The signalr does something with document due to which axios in isStandardBrowserEnv is not properly determining where its running and tries to read cookies in react native app and fails.
I propose we detect react native from navigator.product as it was introduced in this commit for react native:
[https://github.com/facebook/react-native/commit/3c65e62183ce05893be0822da217cb803b121c61](url) | https://github.com/axios/axios/issues/728 | https://github.com/axios/axios/pull/731 | 161c616211bf5a0b01219ae6aa2b7941192ef2c1 | 2f98d8fcdba89ebd4cc0b098ee2f1af4cba69d8d | "2017-02-24T09:51:38Z" | javascript | "2017-03-02T06:04:54Z" |
closed | axios/axios | https://github.com/axios/axios | 718 | ["index.d.ts", "test/typescript/axios.ts"] | Generic get for TypeScript | Hello,
As axios automatically converts JSON responses could we get something like this:
```ts
get<T>(url: string, config?: AxiosRequestConfig): AxiosPromise<T>;
export interface AxiosPromise<T> extends Promise<AxiosResponse<T>> {
}
export interface AxiosResponse<T> {
data: T;
status: number;
statusText: string;
headers: any;
config: AxiosRequestConfig;
}
``` | https://github.com/axios/axios/issues/718 | https://github.com/axios/axios/pull/1061 | 638804aa2c16e1dfaa5e96e68368c0981048c4c4 | 7133141cb9472f88220bdaf6e6ccef898786298d | "2017-02-21T20:43:37Z" | javascript | "2017-10-20T14:16:23Z" |
closed | axios/axios | https://github.com/axios/axios | 717 | [".github/workflows/stale.yml"] | HTML response is not considered an error? | Without setting an `Accept` header responses in HTML of content type `text/html` are not considered an error by axios by default?
It seems to wrap the response, although being 200 - OK into a `{data: <html>blabla</html>, status: 200}`. How can I enforce json responses and everything else considered an error? | https://github.com/axios/axios/issues/717 | https://github.com/axios/axios/pull/4980 | 60e85533b3c38687b862d5a77bdf9614d1e3f6d0 | 659eeaf67cc0d54e86d0e38b90bd6f8174f56fca | "2017-02-21T20:26:28Z" | javascript | "2022-09-29T06:27:44Z" |
closed | axios/axios | https://github.com/axios/axios | 662 | [".github/workflows/stale.yml"] | HTTPS request works using the https module but not in Axios | This request works with the https library:
```
const options = {
hostname: 'baseurl.com',
path: '/accounts',
method: 'GET',
ca: fs.readFileSync(`${path}CA.pem`),
cert: fs.readFileSync(`${path}CERT.pem`),
key: fs.readFileSync(`${path}KEY.pem`),
auth: 'user:password',
rejectUnauthorized: false
};
const req = https.request(options, (res) => {
res.on('data', (data) => {
process.stdout.write(data);
});
});
req.end();
req.on('error', (e) => {
console.error(e);
});
```
but this seemingly equivalent request does not work using Axios:
```
const instance = axios.create({
baseURL: 'https://baseurl.com',
httpsAgent: new https.Agent({
ca: fs.readFileSync(`${path}CA.pem`),
cert: fs.readFileSync(`${path}CERT.pem`),
key: fs.readFileSync(`${path}KEY.pem`),
auth: 'user:password',
rejectUnauthorized: false
})
});
instance.get('/accounts')
.then(_ => console.log(`response: ${_}`))
.catch(err => console.log(`error: ${err.stack}`));
```
Instead it throws this error:
error: Error: write EPROTO
at Object.exports._errnoException (util.js:870:11)
at exports._exceptionWithHostPort (util.js:893:20)
at WriteWrap.afterWrite (net.js:763:14)
I've tried these variations of base url but no luck:
- 'https://baseurl.com:443'
- 'baseurl.com'
- 'baseurl.com:443'
any help much appreciated. | https://github.com/axios/axios/issues/662 | https://github.com/axios/axios/pull/4797 | de7f4c6c393acab30e27b5b35f3846518aabc28d | 68723fc38923f99d34a78efb0f68de97890d0bec | "2017-01-23T11:08:26Z" | javascript | "2022-06-18T09:13:19Z" |
closed | axios/axios | https://github.com/axios/axios | 658 | ["package-lock.json"] | Error when trying to connect to HTTPS site through proxy | I get this error when connecting to an HTTPS site through a proxy. It works fine when I connect to that same site using HTTP (the site is available in both HTTP and HTTPS). To test it you can try with any HTTPS proxies (test ones available at https://free-proxy-list.net/, I've tried only the ones with a 'Yes' in the 'Https' column.)
```
(node:11581) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2):
Error: write EPROTO 140378207070016:error:140770FC:SSL
routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:794:
```
The code
```js
async function download() {
const response = await axios('https://api.ipify.org', {
timeout: 5000,
proxy: {
host: '104.154.142.106',
port: 3128
}
})
console.log(response.headers)
}
``` | https://github.com/axios/axios/issues/658 | https://github.com/axios/axios/pull/5294 | 3a7c363e540e388481346e0c0a3c80e8318dbf5d | e1989e91de13f2d6cd6732745ae64dbc41e288de | "2017-01-18T12:53:02Z" | javascript | "2022-11-22T17:56:32Z" |
closed | axios/axios | https://github.com/axios/axios | 635 | ["README.md", "lib/adapters/http.js", "test/unit/adapters/http.js"] | Is there a way to force not to use proxy? | In my case I have a `http_proxy` env variable on my development computer which passes all traffic to my vpn, however this proxy would fail to work when hostname is `localhost`, therefore when I'm testing my application it always fails because I setup my server at localhost, I want a method to force axios receiving a `none` for proxy config, currently if `proxy` property is `null` or `undefined` it will use the `http_proxy` env | https://github.com/axios/axios/issues/635 | https://github.com/axios/axios/pull/691 | 62db26b58854f53beed0d9513b5cf18615c64a2d | 07a7b7c84c3ea82ea3f624330be9e0d3f738ac70 | "2017-01-06T06:34:50Z" | javascript | "2017-08-14T11:38:44Z" |
closed | axios/axios | https://github.com/axios/axios | 615 | ["README.md"] | Change the browser support logo links in Readme file | Change the logos of different browsers in the Readme section by updating the links of the original repository. | https://github.com/axios/axios/issues/615 | https://github.com/axios/axios/pull/616 | 322be107301c5c725b13e3c0c00108e55655f540 | 253131c31ae1269099efb865eb0469a218e1ab2d | "2016-12-25T19:56:48Z" | javascript | "2017-01-08T13:55:01Z" |
closed | axios/axios | https://github.com/axios/axios | 605 | ["package-lock.json"] | https request localhost api contradiction for React server rendering | That's say I have an express api server along with web server rendering,
axios for react server side render need to specify the domain like `localhost:3001/getUser`
If the website is https but request api to the same server from `localhost`,it's `http`.
It will cause Error for untrust request from https to http.
so I change the `axios.post(localhost:3001/getUser)` to `axios.post(/getUser)`,it solved untrust origin.
But another Error appear is that react server side render need axios to specify domain. | https://github.com/axios/axios/issues/605 | https://github.com/axios/axios/pull/5493 | 366161e5e48f818fa42c906e91b71f7876aadabb | a105feb7b5f8abca95a30d476707288268123892 | "2016-12-17T01:51:05Z" | javascript | "2023-01-26T18:19:48Z" |
closed | axios/axios | https://github.com/axios/axios | 597 | ["lib/utils.js"] | IE8 is determined wrong as non standard browser environment. | In IE8, the value of `typeof document.createElemen` is `object`, not `function` so this `isStandardBrowserEnv` returns `false`.
```
function isStandardBrowserEnv() {
return (
typeof window !== 'undefined' &&
typeof document !== 'undefined' &&
typeof document.createElement !== 'function'
);
}
```
Because of this wrong determine, XDomainRequest is not working in IE8. I made a pull request for fix this, but failed to pass the CI. | https://github.com/axios/axios/issues/597 | https://github.com/axios/axios/pull/731 | 161c616211bf5a0b01219ae6aa2b7941192ef2c1 | 2f98d8fcdba89ebd4cc0b098ee2f1af4cba69d8d | "2016-12-15T11:18:10Z" | javascript | "2017-03-02T06:04:54Z" |
closed | axios/axios | https://github.com/axios/axios | 537 | ["lib/adapters/xhr.js", "test/specs/requests.spec.js"] | Axios 0.15.2 doesn't reject promise if request is cancelled in Chrome | I have [email protected]
If this HTML is run, some requests will be cancelled by Chrome:
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.15.2/axios.js"></script>
</head>
<script>
var promises = [];
window.onload = function() {
for (var i = 0; i < 4; i++) {
var promise = axios.get('some url which causes ERR_CONNECTION_CLOSED');
promises.push(promise);
}
}
</script>
</html>

But promises which turned into cancelled request won't be fulfilled:

| https://github.com/axios/axios/issues/537 | https://github.com/axios/axios/pull/1399 | d4dc124f15c8dc69861b9cf92c059dbda46ae565 | 0499a970d7064d15c9361430b40729d9b8e6f6bb | "2016-11-16T14:01:23Z" | javascript | "2018-03-07T19:50:16Z" |
closed | axios/axios | https://github.com/axios/axios | 476 | ["README.md", "lib/adapters/http.js", "test/unit/adapters/http.js"] | HTTP proxy authentication | HTTP proxy support was added in #366, but the proxy configuration only takes into account the proxy host and port. We are running in an environment that requires authenticating to the proxy, and as far as I understood, axios doesn't support that. We are using the standard `http_proxy` and `https_proxy` environment variables with the credentials in the URL, like `http://proxy-user:proxy-password@proxy-host:proxy-port`, and passing that works as expected with e.g. [superagent-proxy](https://github.com/TooTallNate/superagent-proxy).
So I'm requesting to have support for HTTP proxy authentication, preferably even taking the credentials automatically from HTTP proxy environment variables.
| https://github.com/axios/axios/issues/476 | https://github.com/axios/axios/pull/483 | b78f3fe79298a000f056ff40bbd1447c2d667cc5 | df6d3ce6cf10432b7920d8c3ac0efb7254989bc4 | "2016-10-10T15:25:28Z" | javascript | "2016-10-19T09:02:42Z" |
closed | axios/axios | https://github.com/axios/axios | 460 | [".github/workflows/ci.yml"] | Converting circular structure to JSON | I tray send request with data:

```
console.log({ setting });
const request = axios.post(SETTINGS_URL, { setting });
```
Error:
defaults.js:37 Uncaught (in promise) TypeError: Converting circular structure to JSON(…)
| https://github.com/axios/axios/issues/460 | https://github.com/axios/axios/pull/4798 | 68723fc38923f99d34a78efb0f68de97890d0bec | 1db715dd3b67c2b6dd7bdaa39bb0aa9d013d9fd2 | "2016-09-29T12:19:36Z" | javascript | "2022-06-18T09:15:53Z" |
closed | axios/axios | https://github.com/axios/axios | 434 | ["package-lock.json"] | Need to bypass proxy | I have some endpoints that my proxy server doesn't handle well and in my NodeJS environment the http_proxy environment is set.
Can you honor the no_proxy environmental variable and/or allow a config option to disable proxy usage?
I'm using [email protected] for now.
| https://github.com/axios/axios/issues/434 | https://github.com/axios/axios/pull/4506 | 170588f3d78f855450d1ce50968651a54cda7386 | 2396fcd7e9b27853670759ee95d8f64156730159 | "2016-09-02T00:47:37Z" | javascript | "2022-03-07T07:13:50Z" |
closed | axios/axios | https://github.com/axios/axios | 395 | ["lib/adapters/xhr.js", "test/specs/xsrf.spec.js"] | Fails on same origin request running inside a sandboxed iframe | When I do run a GET request within an `<iframe sandbox="allow-scripts" />` to an URI on the same origin of the iframe, the request fails with the error:
`DOMException: Failed to read the 'cookie' property from 'Document': The document is sandboxed and lacks the 'allow-same-origin' flag.`
The issue is actually caused by the XHR adapter, while reading the cookies, since you can't access cookies in a sandboxed iframe:
```
// Add xsrf header
// This is only done if running in a standard browser environment.
// Specifically not if we're in a web worker, or react-native.
if (utils.isStandardBrowserEnv()) {
var cookies = require('./../helpers/cookies');
// Add xsrf header
var xsrfValue = config.withCredentials || isURLSameOrigin(config.url) ?
cookies.read(config.xsrfCookieName) :
undefined;
if (xsrfValue) {
requestHeaders[config.xsrfHeaderName] = xsrfValue;
}
}
```
I'm willing to submit a PR to fix it, but I'm actually wondering what's the best approach in your opinion (according to the axios design):
1. Add a try/catch in `helpers/cookies.js` `read()` function and `return null` on error
2. Add an option to disable the XSRF header, or implicitely disable it if `config.xsrfHeaderName === null`
3. ... any other suggestion is welcome
Thank you,
Marco
| https://github.com/axios/axios/issues/395 | https://github.com/axios/axios/pull/406 | 8abe0d4007dd6b3fae5a1c4e019587b7a7f50930 | 6132d9630d641d253f268c8aa2e128aef94ed44f | "2016-08-01T11:10:35Z" | javascript | "2016-08-13T00:02:59Z" |
closed | axios/axios | https://github.com/axios/axios | 382 | ["lib/core/dispatchRequest.js", "lib/utils.js", "test/specs/headers.spec.js", "test/specs/utils/deepMerge.spec.js"] | Don't send default header | If a header has been set as a default, there does not appear to be any way to skip it on an individual request. Setting `null` or `undefined` doesn't do anything.
| https://github.com/axios/axios/issues/382 | https://github.com/axios/axios/pull/1845 | 4b3947aa59aaa3c0a6187ef20d1b9dddb9bbf066 | 487941663b791a4a5273d456aab24c6ddd10eb0e | "2016-07-19T21:34:53Z" | javascript | "2020-06-04T18:57:54Z" |
closed | axios/axios | https://github.com/axios/axios | 379 | [".gitignore", ".npmignore", "Gruntfile.js", "axios.d.ts", "lib/axios.js", "package.json", "test/specs/instance.spec.js", "test/typescript/axios.ts", "typings.json"] | Update Typings | This is a catch all for the multiple requests to update the type definition. Needs to be done for the next release.
| https://github.com/axios/axios/issues/379 | https://github.com/axios/axios/pull/419 | fa5ce95fdcee5c3a6c0ffac0164f148351ae3081 | 59080e68d983782445eded3a39f426161611e749 | "2016-07-16T17:47:27Z" | javascript | "2016-08-19T03:42:03Z" |
closed | axios/axios | https://github.com/axios/axios | 358 | [".github/workflows/ci.yml"] | `progress` config option not working | I'm attempting to use the `progress` config option as shown below in my code. It appears to mimic exactly what is in the example, but it never actually enters the function.
```
var form = new FormData()
form.append('content', fs.createReadStream('./myfile.mkv');
axios.post("http://example.com", form, {
progress: (progressEvent) => {
console.log('progress!');
}
})
.then(response => {
console.log('done');
})
.catch(err => {
console.log('failed');
});
```
It outputs `done`, but nothing is outputted on progress. Also, it's worth noting I attempted this with very large files (1GB) and no progress function was ever entered.
| https://github.com/axios/axios/issues/358 | https://github.com/axios/axios/pull/4798 | 68723fc38923f99d34a78efb0f68de97890d0bec | 1db715dd3b67c2b6dd7bdaa39bb0aa9d013d9fd2 | "2016-06-25T00:43:11Z" | javascript | "2022-06-18T09:15:53Z" |
closed | axios/axios | https://github.com/axios/axios | 298 | ["package-lock.json"] | Client side support for protecting against XSRF | hi,
- i am new to js.
- i am trying to learn how you guys implemented, the Promise API and Client side support for protecting against XSRF
- can you tell me which files I need to look for in axios to get those codes
| https://github.com/axios/axios/issues/298 | https://github.com/axios/axios/pull/5438 | b4b5b360ec9c9be80f69e99b436ef543072b8b43 | ebb9e814436d2f6c7cc65ffecb6ff013539ce961 | "2016-04-18T16:20:22Z" | javascript | "2023-01-07T16:15:58Z" |
closed | axios/axios | https://github.com/axios/axios | 295 | ["package-lock.json"] | How can i get set-cookie header ? | Hello.
"Set-Cookie" header exist in HTTP response header. But axios response didn't have "set-cookie" header.
Response header have only "content-type".
How can i get "set-cookie" header ?
| https://github.com/axios/axios/issues/295 | https://github.com/axios/axios/pull/5438 | b4b5b360ec9c9be80f69e99b436ef543072b8b43 | ebb9e814436d2f6c7cc65ffecb6ff013539ce961 | "2016-04-14T05:26:00Z" | javascript | "2023-01-07T16:15:58Z" |
closed | axios/axios | https://github.com/axios/axios | 273 | [".travis.yml", "karma.conf.js"] | All PR builds fail due to Travis security restrictions | From https://docs.travis-ci.com/user/encryption-keys/ :
"Please note that encrypted environment variables are not available for pull requests from forks."
Also, from https://docs.travis-ci.com/user/pull-requests#Security-Restrictions-when-testing-Pull-Requests :
"If your build relies on these to run, for instance to run Selenium tests with Sauce Labs, your build needs to take this into account. You won’t be able to run these tests for pull requests from external contributors."
| https://github.com/axios/axios/issues/273 | https://github.com/axios/axios/pull/274 | e22cbae49447f1c88680cc3d97888b6949f6a41f | 104276ffa774760d0b00cb1312621d5b1993e483 | "2016-03-22T02:07:15Z" | javascript | "2016-03-24T06:02:45Z" |
closed | axios/axios | https://github.com/axios/axios | 266 | ["package-lock.json"] | Interceptors - how to prevent intercepted messages from resolving as error | I'm trying to make an interceptor for 401 responses that result from expired token. Upon interception I want to login and retry the requests with the new token. My problem is that login is also done asynchronously, so by the time the retry happens, the original promises reject. Is there a way around that? Here's my code:
```
axios.interceptors.response.use(undefined, err => {
if (err.status === 401 && err.config && !err.config.__isRetryRequest) {
refreshLogin(getRefreshToken(),
success => {
setTokens(success.access_token, success.refresh_token)
err.config.__isRetryRequest = true
err.config.headers.Authorization = 'Bearer ' + getAccessToken()
axios(err.config)
},
error => { console.log('Refresh login error: ', error) }
)
}
})
```
| https://github.com/axios/axios/issues/266 | https://github.com/axios/axios/pull/5438 | b4b5b360ec9c9be80f69e99b436ef543072b8b43 | ebb9e814436d2f6c7cc65ffecb6ff013539ce961 | "2016-03-14T21:09:11Z" | javascript | "2023-01-07T16:15:58Z" |
closed | axios/axios | https://github.com/axios/axios | 226 | ["package-lock.json"] | XHR timeout does not trigger reject on the Promise | Axios [set the timeout](https://github.com/mzabriskie/axios/blob/master/lib/adapters/xhr.js#L36) for XHR request, but doesn't listen to `ontimeout` events, rejecting the promise, so my `then` and `catch` are never called.
The PR #227 to fixes that
| https://github.com/axios/axios/issues/226 | https://github.com/axios/axios/pull/5295 | f79cf7bfa9fadd647ac8e22f1a3ff491d6c37e13 | 2c83d47e37554a49b8df4899fd0d9ee0ff48f95d | "2016-02-05T17:52:06Z" | javascript | "2022-11-22T18:23:57Z" |
closed | axios/axios | https://github.com/axios/axios | 220 | ["package-lock.json"] | Custom instance defaults can't be set as documented | https://github.com/mzabriskie/axios#custom-instance-defaults
Because the defaults from `defaults.js` are not merged in here: https://github.com/mzabriskie/axios/blob/master/lib/axios.js#L88, `instance.defaults.headers` will be `undefined`.
I'll try to make a PR some time soon.
| https://github.com/axios/axios/issues/220 | https://github.com/axios/axios/pull/5245 | 0da6db79956aef9e8b5951123bab4dd5decd8c4c | 7f0fc695693dbc9309fe86acbdf9f84614138011 | "2016-02-02T10:56:56Z" | javascript | "2022-11-10T12:02:26Z" |
closed | axios/axios | https://github.com/axios/axios | 199 | ["package-lock.json"] | Both then and catch executing in same call | I'm doing this call:
```
axios.get('/groups', {
baseURL: 'http://localhost:5000',
headers: { Authorization: 'Bearer ' + getAccessToken(), 'Content-Type': 'application/json; charset=utf-8' }
})
.then((response) => {
console.log('then response',response)
success(response.data)} )
.catch((response) => {
console.log('catch response',response)
error(response.status, response.data.description)})
```
I'm calling this exactly once. I get a 200 OK response, `then` block executes, with `response` being an object I would normally expect. Right after that `catch` executes, response being a string:
```
TypeError: Cannot read property 'groups' of null(…)
```
Closing: my bad, it was an error somewhere very far in the code, still trying to figure out how it made it into the promise...
| https://github.com/axios/axios/issues/199 | https://github.com/axios/axios/pull/5438 | b4b5b360ec9c9be80f69e99b436ef543072b8b43 | ebb9e814436d2f6c7cc65ffecb6ff013539ce961 | "2016-01-20T18:30:08Z" | javascript | "2023-01-07T16:15:58Z" |
closed | axios/axios | https://github.com/axios/axios | 107 | ["lib/core/Axios.js", "lib/core/dispatchRequest.js", "lib/core/mergeConfig.js", "lib/utils.js", "test/specs/core/mergeConfig.spec.js", "test/specs/headers.spec.js", "test/specs/requests.spec.js", "test/specs/utils/deepMerge.spec.js", "test/specs/utils/isX.spec.js", "test/specs/utils/merge.spec.js"] | support the standard $http_proxy env var, like cURL and many programs do | This should "just work", and can build on the resolution to #68 .
https://www.google.com/search?q=http_proxy
This would allow proxying behind a corporate firewall without any/every 3rd party module using axios requiring code changes to support proxying.
| https://github.com/axios/axios/issues/107 | https://github.com/axios/axios/pull/2844 | 487941663b791a4a5273d456aab24c6ddd10eb0e | 0d69a79c81a475f1cca6d83d824eed1e5b0b045d | "2015-09-09T18:49:14Z" | javascript | "2020-06-08T18:52:45Z" |
closed | axios/axios | https://github.com/axios/axios | 38 | ["lib/core/Axios.js", "lib/core/dispatchRequest.js", "lib/core/mergeConfig.js", "lib/utils.js", "test/specs/core/mergeConfig.spec.js", "test/specs/headers.spec.js", "test/specs/requests.spec.js", "test/specs/utils/deepMerge.spec.js", "test/specs/utils/isX.spec.js", "test/specs/utils/merge.spec.js"] | corrupted multibyte characters in node | Multibyte characters on chunk boundaries get corrupted.
| https://github.com/axios/axios/issues/38 | https://github.com/axios/axios/pull/2844 | 487941663b791a4a5273d456aab24c6ddd10eb0e | 0d69a79c81a475f1cca6d83d824eed1e5b0b045d | "2015-01-27T14:52:54Z" | javascript | "2020-06-08T18:52:45Z" |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 15,661 | ["dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/GlobalTaskDispatchWaitingQueue.java", "dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/GlobalTaskDispatchWaitingQueueLooper.java", "dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/runner/GlobalTaskDispatchWaitingQueueLooperTest.java", "pom.xml"] | [Bug] [Master] The task has been killed might still be dispatched | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
If the task is in dispatch waiting queue, then we kill the task it might still be dispatched.
### What you expected to happen
The killed task will not be dispatched.
### How to reproduce
1. Create a task with delay.
2. Start the workflow
3. Kill the workflow instance.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/15661 | https://github.com/apache/dolphinscheduler/pull/15662 | 040ab34bafa25c5fd17f4ca172f05f55aa2ab446 | 04a6b0d2814c69b056639f65546ffd62ead22321 | "2024-03-02T12:46:53Z" | java | "2024-03-04T09:30:43Z" |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 15,649 | ["docs/configs/docsdev.js"] | [Doc][remote shell] missing remote shell doc for version 3.2.1 | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
https://github.com/apache/dolphinscheduler/tree/dev/dolphinscheduler-task-plugin/dolphinscheduler-task-remoteshell code exists but doc not exists
### Documentation Links
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/15649 | https://github.com/apache/dolphinscheduler/pull/15660 | 502b49a1cb845c04c6b754e88748d2de8ef84508 | 040ab34bafa25c5fd17f4ca172f05f55aa2ab446 | "2024-02-28T08:11:24Z" | java | "2024-03-04T08:49:22Z" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.