Commit Graph

52 Commits

Author SHA1 Message Date
Jay
d660e29c1a
Revert "Fixed isFormData predicate; (#4413)" (#4472)
This reverts commit 73e3bdb883.
2022-02-13 15:47:38 +02:00
Dmitriy Mozgovoy
73e3bdb883
Fixed isFormData predicate; (#4413)
Added support for automatic object serialization to FormData if `Content-Type` is `multipart/form-data`;
Added support for FormData to be overloaded using `config.env.FormData` option;
Added support for FormData in node.js environment through `form-data` package;
2022-02-02 13:48:44 +02:00
狼族小狈
a8cd75a081
Update isAbsoluteURL.js (#3809)
Escaping non-special characters in strings, template literals, and regular expressions doesn't have any effect, as demonstrated in the following example:

https://eslint.org/docs/rules/no-useless-escape

Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-12-23 13:33:16 +02:00
Ben Carp
99648153ce
toFormData helper function (#3757)
* adding toFormData test

* adding toFormData

Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-12-23 10:21:51 +02:00
Black-Hole
6fca6a7027
refactor(helpers): optimize the logic of isAxiosError (#3546)
1. add the judgment of null

Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-12-22 21:09:33 +02:00
Jay
76f09afc03
Release/v0.22.0 (#4107)
* fix/Avoid package.json import; (#4041)

* Added auto-generated config module `env/data.js` for importing package environment vars without importing the whole `package.json`;
Refactored `http.js` to use `env/data.js` instead of package.json;

* Added `env/data.js`;
Added `env/README.md`;

* Feat/export package version constant (#4065)

* Added auto-generated config module `env/data.js` for importing package environment vars without importing the whole `package.json`;
Refactored `http.js` to use `env/data.js` instead of package.json;

* Added `env/data.js`;
Added `env/README.md`;

* Export package version constant;

* Fixed cancelToken leakage; Added AbortController support; (#3305)

* Fixed cancelToken leakage;
Added AbortController support;

* Fixed typings;

* Documented `signal` option;

* Added processing of early cancellation using AbortController without sending a request;

Co-authored-by: Jay <jasonsaayman@gmail.com>

* Updating CI to run on release branches

* Fixed default transitional config for custom Axios instance; (#4052)

Refactored `/core/mergeConfig`;

Co-authored-by: Jay <jasonsaayman@gmail.com>

* Prepping v0.22.0 for release

* Updated date

Co-authored-by: Dmitriy Mozgovoy <robotshara@gmail.com>
2021-10-01 08:02:13 +02:00
Dmitriy Mozgovoy
5ad6994da3
JSON improvements: throw if JSON parsing failed; number, boolean can be passed directly as payload for encoding to JSON #2613, #61, #907 (#3688)
* Draft

* Added support for primitive types to be converted to JSON if the request Content-Type is 'application/json';
Added throwing SyntaxError if JSON parsing failed and responseType is json;
Added transitional option object;
Added options validator to assert transitional options;
Added transitional option `silentJSONParsing= true` for backward compatibility;
Updated README.md;
Updated typings;

* Fixed isOlderVersion helper;
Fixed typo;
Added validator.spec.js;

* Added forcedJSONParsing transitional option #2791

* `transformData` is now called in the default configuration context if the function context is not specified (for tests compatibility);

* Added `transitional.clarifyTimeoutError` to throw ETIMEDOUT error instead of generic ECONNABORTED on request timeouts;
Added support of onloadend handler if available instead of onreadystatechange;
Added xhr timeout test;
Fixed potential bug of xhr adapter with proper handling timeouts&errors (FakeXMLHTTPRequest failed to handle timeouts);
2021-04-19 18:55:34 +02:00
Jason Kwok
f472e5da5f
Adding a type guard for AxiosError (#2949)
Co-authored-by: Jason Kwok <JasonHK@users.noreply.github.com>
2020-11-03 10:01:07 +02:00
David
8a8c534a60
Fixing special char encoding (#1671)
* removing @ character from replacement list since it is a reserved character

* Updating buildURL test to not include the @ character

* Removing console logs

Co-authored-by: Jay <jasonsaayman@gmail.com>
2020-05-27 14:37:39 +02: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
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
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
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
e9c481fa5e Delete btoa polyfill 2018-08-06 09:56:51 +02:00
Justin Beckwith
22c2baf205 chore: upgrade eslint and add fix command 2018-04-06 21:50:26 -07:00
刘涛
a1e895d670
Update buildURL.js
Two if statements is unnecessary, we can replace with "if ... else ..."
2017-11-23 16:22:55 +08:00
Tyler Brown
fb08e95603 Duplicate header handling (#874)
* Update parseHeaders to match node http behavior

Node ignores duplicate entries for certain HTTP headers.

It also always converts the `set-cookie` header into an array.

* add tests for new duplicate header handling

* clarify comment
2017-08-12 14:58:10 +02:00
Lochlan Bunn
fe7d09bb08 Fixing combineURLs to support an empty relativeURL (#581)
* Fixing combineURLs to support an empty relativeURL

When combining the base and relative URLs, we should forego force
appending a slash to the base when the relative URL is empty.
This leads to a semantic url.

* Fixing combineURLs, allowing single slash relatives
2016-12-07 21:23:45 -08:00
Matt Zabriskie
203cbc2da0 Moving settle & transformData from helpers/ -> core/ 2016-06-01 13:54:38 -06:00
Matt Zabriskie
eea790b8de Adding README to modules 2016-06-01 13:16:16 -06:00
Nick Uraltsev
f20490eb6b Adding support for URLSearchParams 2016-05-07 12:26:28 -07:00
Nick Uraltsev
fa9444e0ba Allow custom HTTP status code error ranges (#308)
Adding support for custom HTTP status code error ranges
2016-04-26 14:18:58 -06:00
Matt Zabriskie
7041775943 Changing btoa ponyfill to improve testing 2016-03-03 22:43:16 -07:00
Jorik Tangelder
986647be59 improve IE support
removes ActiveXObject support, and improves detection of XDomainRequest.
2016-01-03 12:08:09 +01:00
Anth Winter
ff4b5edcbf Added IE version check helper function 2015-12-24 12:03:51 +00:00
Matt Zabriskie
f28a4a8248 Using more strict eslint rules 2015-12-14 20:06:57 -07:00
Matt Zabriskie
2b147fb0b7 Moving bind into it's own file 2015-12-14 20:06:16 -07:00
Matt Zabriskie
77b8966b47 Making btoa polyfill more standard 2015-12-14 12:16:11 -07:00
Matt Zabriskie
5d9ca93bd3 Merge pull request #160 from nickuraltsev/base-url
Add support for baseURL parameter
2015-12-11 11:45:51 -07:00
Idan Gazit
3138600caf Adding btoa polyfill 2015-12-10 17:20:19 +02:00
Nick Uraltsev
20a25a2783 Add isAbsoluteURL helper 2015-11-21 19:29:53 -08:00
Nick Uraltsev
e253b0ef3e Add combineURLs helper 2015-11-21 17:41:02 -08:00
Matt Zabriskie
7fa69152e9 Restoring buildURL 2015-11-20 12:17:14 -07:00
Matt Zabriskie
54be280729 Fixing file system case issue 2015-11-20 12:16:45 -07:00
Matt Zabriskie
3d65057d71 Making isURLSameOrigin/cookies safe to use in all envs 2015-11-19 15:18:47 -07:00
David Fournier
14ede9e18e Add support third-party library to serialize url params 2015-10-27 11:54:44 +01:00
mzabriskie
6aa766e5e9 Adding support for web workers, and react-native
closes #70, closes #98
2015-09-28 18:33:46 -06:00
Jeffrey Horn
a130e787c3 return result from callback
returning the result of the callback allows you to chain the promise
like you would expect
2015-09-02 10:43:27 -07:00
Matt Zabriskie
3b10b6a6c5 Merge pull request #49 from maxhoffmann/master
Fixing arrays in get params
2015-07-23 09:08:16 -07:00
Maximilian Hoffmann
2209226c7c fix missing dot 2015-07-23 10:49:12 +02:00
Maximilian Hoffmann
f44597e38b don’t escape square brackets 2015-07-23 10:46:21 +02:00
mzabriskie
8365cbb789 Updating dependencies 2015-06-18 21:07:29 -06:00
Maximilian Hoffmann
594df987f2 fix array params 2015-05-27 13:32:34 +02:00
mzabriskie
60a82ef424 Changing to file level use strict statement 2015-03-18 17:21:15 -06:00
mzabriskie
a98c61f458 Adding ESLint 2015-03-17 14:14:26 -06:00
mzabriskie
b4d81bd124 Adding comments 2015-01-23 02:12:28 -07:00
mzabriskie
bbf437ce4c Cleaning up core axios a bit 2015-01-23 02:11:57 -07:00