2
0
mirror of https://github.com/tenrok/axios.git synced 2026-05-21 13:24:11 +03:00
Commit Graph

342 Commits

Author SHA1 Message Date
Jay cbda78552b Revert "Bug/allow header to contain http verb keys #1252 (#1258)" (#2977)
This reverts commit 920510b3a6.
2020-05-22 21:44:26 +02:00
David Ko 920510b3a6 Bug/allow header to contain http verb keys #1252 (#1258)
* Failing test for #1252

* Only delete header keys that match an HTTP verb if the value is a non-string

Co-authored-by: David Ko <david.ko@pvtmethod.com>
Co-authored-by: Jay <jasonsaayman@gmail.com>
2020-05-22 21:26:10 +02:00
Ryan Bown 1cdf9e4039 Fixing Cookie Helper with Asyc Components (#1105) (#1107)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2020-05-22 16:44:17 +02:00
Alan Wang 885ada6d9b Fixing getting local files (file://) failed (#2470)
* fix issue #2416, #2396

* fix Eslint warn

* Modify judgment conditions

* add unit test

* update unit test

* update unit test
2020-03-23 21:49:38 +08:00
Spencer von der Ohe 42eb9dfabc Adding option to disable automatic decompression (#2661)
* Adding ability to disable auto decompression

* Updating decompress documentation in README

* Fixing test\unit\adapters\http.js lint errors

* Adding test for disabling auto decompression

* Removing changes that fixed lint errors in tests

* Removing formating change to unit test

Co-authored-by: Xianming Zhong <chinesedfan@qq.com>
2020-03-06 22:01:58 +08:00
Gustavo López 6642ca9aa1 Add independent maxBodyLength option (#2781)
* Add independent option to set the maximum size of the request body

* Remove maxBodyLength check

* Update README

* Assert for error code and message
2020-03-06 21:55:19 +08:00
Thibault Ehrhart 17a967123c Adding responseEncoding to mergeConfig (#1745)
Co-authored-by: Xianming Zhong <chinesedfan@qq.com>
2020-02-15 21:49:26 +08:00
Nikita Galkin 12e00b8018 Fixing issue for HEAD method and gziped repsonse (#2666) 2020-02-15 18:10:58 +08:00
Xianming Zhong 56b72bbd2c Compatible with follow-redirect aborts the request (#2689)
* Compatible with follow-redirect aborts the request

* Use the error code
2020-02-15 13:41:08 +08:00
Jonathan Sharpe 77f0ae4f61 Fix merging of params (#2656)
* Name function to avoid ESLint func-names warning

* Switch params config to merge list and update tests

* Restore testing of both false and null

* Restore test cases for keys without defaults

* Include test for non-object values that aren't false-y.
2020-02-15 13:36:52 +08:00
Xianming Zhong c7488c7dd5 Remove unnecessary XSS check introduced by #2451 (#2679)
* Remove unnecessary XSS check introduced by #2451

* Remove test file of `isValidXss`
2020-01-20 09:20:33 -07:00
不才 ee47120a09 If this place is false, it will report an error, so you should delete the useless code. (#2458) 2019-12-25 13:00:15 -08:00
Michael Shin 03e6f4bf4c Fixing invalid agent issue (#1904) 2019-12-25 12:55:36 -08:00
ZhaoXC dc4bc49673 fix: fix ignore set withCredentials false (#2582) 2019-12-08 23:52:45 -08:00
Alanscut 13c948e661 Remove 'includes' API, fix CI build failure (#2574)
* Remove 'includes' API, fix CI build failure
2019-12-09 10:28:37 +08:00
Angelos Chalaris 1a32ca0601 Remove dependency on is-buffer (#1816)
* Remove dependency on is-buffer from package.json
2019-11-17 22:53:27 -08:00
Yasu Flores 841466416b Fix XSS logic that matched some valid urls (#2529)
* Fix XSS logic that matched some valid urls, e.g. "/one/?foo=bar", when it shouldn't match those
2019-11-07 18:39:24 -08:00
Felipe Martins 097948698a Revert "Update Webpack + deps, remove now unnecessary polyfills" (#2479)
* Revert "Update Webpack + deps, remove now unnecessary polyfills (#2410)"

This reverts commit 189b34c45a.

* Fix build (#2496)

* Change syntax to see if build passes

* Test commit

* Test with node 10

* Test adding all browsers in travis

* remove other browsers when running on travis
2019-10-25 11:34:47 -03:00
Avindra Goolcharan 189b34c45a Update Webpack + deps, remove now unnecessary polyfills (#2410)
* Update deps

 * handles webpack 1 -> 4 migration

* remove promise helpers from dev files

assume `Promise` is available, or polyfilled by
the consumer

* Remove isArray util. `isArray` has good coverage, even
   in IE9. So lets remove the custom polyfill.

 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray

also resolves a few lint issues

* Remove trim util

String.protoype.trim has good coverage (including IE9)

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim

Also, the http adapter already uses the native method.
2019-10-21 15:56:29 -03:00
Yasu Flores 29da6b24db Fix to prevent XSS, throw an error when the URL contains a JS script (#2464)
* Fixes issue where XSS scripts attacks were possible via the URL

* Fix error

* Move throwing error up

* Add specs and make regex cover more xss cases
2019-10-16 07:53:10 -03:00
IVLIU 6284abfa06 custom timeout prompt copy (#2275)
* style: ui

* feat: custom timeout txtx

* feat: custom timeout txtx
2019-10-15 22:29:16 -03:00
Wataru 19969b4fbd Fixing Vulnerability A Fortify Scan finds a critical Cross-Site Scrip… (#2451)
* Fixing Vulnerability A Fortify Scan finds a critical Cross-Site Scripting

* use var insted of const
2019-10-08 21:23:34 -03:00
Felipe Martins 85c9d4ffb0 fix: Fixing subdomain handling on no_proxy (#2442) 2019-09-28 20:51:20 -03:00
Jeremie Thomassey 00cd48027b Make redirection from HTTP to HTTPS work (#2426)
When calling an HTTP resource redirecting to a HTTPS one with a keepAlive agent. We get the following error:
```
TypeError [ERR_INVALID_PROTOCOL]: Protocol "https:" not supported. Expected "http:"
    at new ClientRequest (_http_client.js:119:11)
    at Object.request (https.js:281:10)
    at RedirectableRequest._performRequest (/Users/jthomassey/projects/ecom-shop-web/node_modules/follow-redirects/index.js:169:24)
    at RedirectableRequest._processResponse (/Users/jthomassey/projects/ecom-shop-web/node_modules/follow-redirects/index.js:260:10)
    at ClientRequest.RedirectableRequest._onNativeResponse (/Users/jthomassey/projects/ecom-shop-web/node_modules/follow-redirects/index.js:50:10)
    at Object.onceWrapper (events.js:277:13)
    at ClientRequest.emit (events.js:189:13)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:556:21)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17)
    at Socket.socketOnData (_http_client.js:442:20)
```

This can be tested here : 
```
const http = require('http');
const https = require('https');
const axios = require('axios');

axios.get('http://www.photobox.fr', { httpAgent: http.Agent({ keepAlive:true }), httpsAgent: https.Agent({ keepAlive:true }) })
  .then(response => {
    console.log(response);
    console.log(response.headers);
  })
  .catch(error => {
    console.log(error);
  });
```

Axios delegate the redirection to the follow-redirect package which accept an option `agents` for both http and https agent see : https://github.com/follow-redirects/follow-redirects#per-request-options
2019-09-26 09:33:49 -03:00
Ya Hui Liang(Ryou) 93e69625a6 Fixing socket hang up error on node side for slow response. (#1752)
* Fixing socket hang up error on node side for slow response.

* eslint check
2019-09-16 05:58:58 -03:00
Joshua Melvin 1b07fb9365 Fixing issue 2195 - order of if/else blocks is causing unit tests mocking XHR. (#2201) 2019-09-13 09:35:59 -03:00
Rafael Renan Pacheco a11cdf4683 Fixing custom config options (#2207)
- fixes #2203
2019-09-06 21:40:04 -03:00
bushuai e50a08b2c3 Fixing set config.method after mergeConfig for Axios.prototype.request (#2383)
Inside Axios.prototype.request function, It's forced to set
method to 'get' after `mergeConfig` if config.method exists, which makes the defaults.method not effective.
2019-09-06 14:23:55 -03:00
DIO 89bd3abe9a Axios create url bug (#2290)
* Fix #2234 

* added spacing --eslint

* added test cases

* removed unexpected cases after updating the code
2019-09-06 12:45:18 -03:00
multicolaure 6fe506fda2 Do not modify config.url when using a relative baseURL (resolves #1628) (#2391)
* Adding tests to show config.url mutation

Because config.url is modified while processing the request
when the baseURL is set,
it is impossible to perform a retry with the provided config object.

Ref #1628

* Fixing url combining without modifying config.url

As config.url is not modified anymore during the request processing.
The request can safely be retried after it failed with the provided
config.

resolves #1628
2019-09-05 12:43:55 -03:00
drawski fd0c959355 Unzip response body only for statuses != 204 (#1129) 2019-05-15 13:35:09 -06:00
Gadzhi Gadzhiev 0d4fca085b Destroy stream on exceeding maxContentLength (fixes #1098) (#1485) 2019-05-07 15:20:34 -04:00
Anatoly Ryabov 81eaa3db4c Fixing building url with hash mark (#1771)
This commit fix building url with hash map (fragment identifier) when parameters are present: they must not be added after `#`, because client cut everything after `#`
2018-09-04 09:53:57 +02:00
Rikki Gibson 21ae22dbd3 Preserve HTTP method when following redirect (#1758)
Resolves #1158

This modifies http.js to uppercase the HTTP method, similar to xhr.js, before passing the request off to the transport. This causes follow-redirects to preserve the HTTP method when automatically making a request to the next URL.
2018-08-27 17:26:38 +02:00
Ayush Gupta b681e919c4 Adding isAxiosError flag to errors thrown by axios (#1419) 2018-08-20 11:02:23 +02:00
Anthony Gauthier 4f98acc578 Add getUri method (#1712)
* Added getUri method

* Removed usage of "url"

* added method to README
2018-08-07 11:52:30 -06:00
Chance Dickson 38de25257c Adding support for no_proxy env variable (#1693)
* Adding support for no_proxy env variable

* Adds support for the no_proxy environment variable commonly available
  with programs supporting the http_proxy/https_proxy environment
  variables.
* Adds tests to test the no_proxy environment variable.

* Adding documentation for the proxy env variables

* Adds documentation to README.md for the supported, conventional
  http_proxy, https_proxy, and no_proxy environment variables.
2018-08-07 11:52:04 -06:00
Tim Johns 6b44e80ade Added toJSON to decorated Axios errors to faciliate serialization (#1625) 2018-08-06 23:33:55 -06:00
Jacob Wejendorp b4c5d35d28 Fixing accept header normalization (#1698)
Fixes override behavior for `accept` header, when case does not match
the one used in defaults.js
2018-08-06 23:25:23 -06:00
Rikki Gibson 503418718f Remove XDomainRequest special status handling 2018-08-06 09:56:51 +02:00
Rikki Gibson a9831131c3 Remove HTTP 1223 handling
The 1223 error was fixed in IE 10. See https://blogs.msdn.microsoft.com/ieinternals/2012/03/01/internet-explorer-10-consumer-preview-minor-changes-list/
2018-08-06 09:56:51 +02:00
Rikki Gibson e9c481fa5e Delete btoa polyfill 2018-08-06 09:56:51 +02:00
Rikki Gibson 5c754e6e07 Remove ie8/9 special CORS treatment and btoa polyfill 2018-08-06 09:56:51 +02:00
Khaled Garbaya 7d9a29ee4c Fixing http adapter to allow HTTPS connections via HTTP (#959) 2018-07-04 23:51:11 -07:00
Mark van den Broek 787c808c04 Fix: Removes usage of deprecated Buffer constructor. (#1555) (#1622) 2018-07-04 23:47:17 -07:00
arpit 405fe690f9 Fix:Closing curly braces 2018-06-19 14:59:57 +02:00
arpit 8cb7d667fb [NS]: Send false flag isStandardBrowserEnv for Nativescript 2018-06-19 14:59:57 +02:00
Tim Garthwaite 0b3db5d87a Fixing defaults to use httpAdapter if available (#1285)
* Fixing defaults to use httpAdapter if available
* Use a safer, cross-platform method to detect the Node environment
2018-04-11 09:23:38 -06:00
Nick Uraltsev ec97c686ef Merge pull request #1395 from codeclown/instance-options
Fixing #385 - Keep defaults local to instance
2018-04-10 15:28:12 -07:00
Martti Laine 4e8039ef65 Remember socketPath in mergeConfig 2018-04-10 22:29:02 +02:00