2
0
mirror of https://github.com/tenrok/axios.git synced 2026-05-15 11:59:42 +03:00
Commit Graph

105 Commits

Author SHA1 Message Date
Dmitriy Mozgovoy d1980854fe fix(fetch): fix stream handling in Safari by fallback to using a stream reader instead of an async iterator; (#6584) 2024-08-31 22:14:23 +03:00
Dmitriy Mozgovoy df9889b83c fix(fetch): optimize signals composing logic; (#6582) 2024-08-30 21:26:12 +03:00
Dmitriy Mozgovoy fed1a4b2d7 fix(core): fix ReferenceError: navigator is not defined for custom environments; (#6567) 2024-08-23 15:16:42 +03:00
Lev Pachmanov 6b6b605eaf fix(sec): CVE-2024-39338 (#6539) (#6543)
* fix(sec): cve-2024-39338 (#6539)

* fix(sec): fix test
2024-08-13 20:43:05 +02:00
Đỗ Trọng Hải 07a661a2a6 fix(sec): disregard protocol-relative URL to remediate SSRF (#6539)
* fix(sec): disregard protocol-relative URL to remediate SSRF

Signed-off-by: hainenber <dotronghai96@gmail.com>

* feat(test/unit/regression): add regression test to ensure SNYK-JS-AXIOS-7361793 fixed in future version

Signed-off-by: hainenber <dotronghai96@gmail.com>

* chore: add EoF newline + comments

Signed-off-by: hainenber <dotronghai96@gmail.com>

* chore: fix eslint issues

Signed-off-by: hainenber <dotronghai96@gmail.com>

* Update SNYK-JS-AXIOS-7361793.js

Co-authored-by: tom-reinders <tom-reinders@users.noreply.github.com>

---------

Signed-off-by: hainenber <dotronghai96@gmail.com>
Co-authored-by: tom-reinders <tom-reinders@users.noreply.github.com>
2024-08-13 17:03:25 +02:00
Dmitriy Mozgovoy e3c76fc9bd fix(adapter): fix progress event emitting; (#6518) 2024-08-01 16:59:58 +03:00
Dmitriy Mozgovoy 733f15fe5b fix(fetch): fixed ReferenceError issue when TextEncoder is not available in the environment; (#6410) 2024-05-20 16:15:15 +03:00
Dmitriy Mozgovoy a3ff99b59d feat(adapter): add fetch adapter; (#6371) 2024-04-28 22:33:49 +03:00
Dmitriy Mozgovoy 3c0c11cade fix(security): fixed formToJSON prototype pollution vulnerability; (#6167) 2024-01-03 21:37:32 +02:00
Willian Agostini 5e7ad38fb0 fix: Regular Expression Denial of Service (ReDoS) (#6132) 2023-12-26 22:29:26 +02:00
Dmitriy Mozgovoy cff996779b feat(withXSRFToken): added withXSRFToken option as a workaround to achieve the old withCredentials behavior; (#6046) 2023-11-14 15:38:25 +02:00
Dmitriy Mozgovoy 3dc8369e50 fix(platform): fixed emulated browser detection in node.js environment; (#6055) 2023-11-07 22:16:15 +02:00
Dmitriy Mozgovoy 2701911260 feat(dns): added support for a custom lookup function; (#5339) 2023-04-26 02:04:59 +03:00
Dmitriy Mozgovoy 6b3c305fc4 fix(http): use explicit import instead of TextEncoder global; (#5530) 2023-02-03 19:34:07 +02:00
Dmitriy Mozgovoy 08104c028c fix(serializer): fixed serialization of array-like objects; (#5518) 2023-02-01 20:38:59 +02:00
Dmitriy Mozgovoy 9957377260 chore(ci): change release-it git config; (#5512) 2023-01-31 15:39:10 +02:00
Dmitriy Mozgovoy 6ac574e00a feat(fomdata): added support for spec-compliant FormData & Blob types; (#5316) 2023-01-31 01:10:39 +02:00
ItsNotGoodName 65e8d1e28c fix(http): add zlib headers if missing (#5497) 2023-01-31 00:49:37 +02:00
Winnie 56e9ca1a86 fix: Add missing HttpStatusCode (#5345) 2022-12-06 22:34:48 +02:00
Ivan Barsukov 786b113a40 fix: removing multiple/trailing/leading whitespaces (#5022)
* fix: removing multiple/trailing/leading whitespaces

* Reverting changes in the dist directory

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-11-25 15:56:31 +02:00
ChronosMasterOfAllTime b0ebf9fcac Fix: Don't add null values to query string. (#5108)
* feat: add  boolean flag to mimic pre 1.x behavior for paramsSerializer custom function

* chore: update ParamsSerializer Readme

* fix: dont slice hash off URL if not appending params

* Omit nulls from formData serialization

* fix: dont add nulls or undefined values to arrays either

* readme update

* fix test

* chore: documentation

* chore: do TS properly

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-10-15 15:01:59 +02:00
Dmitriy Mozgovoy 9d4b016dde feat: added custom params serializer support; (#5113)
* Added custom params serializer support;

* Added missed semicolon;
Fixed allowUnknown option;

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-10-13 22:12:10 +02:00
Dmitriy Mozgovoy cd8989a987 Fixed missed minified builds; (#4805)
* Fixed missed minified builds;
Refactored utils.js;
Refactored `utils.isStandardBrowserEnv()` as a `platform/browser` property;
Added builds size log;

* Replaced `rollup-plugin-filesize` with `rollup-plugin-bundle-size`;

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-08-01 19:13:14 +02:00
Dmitriy Mozgovoy bdf493cf8b Axios ES2017 (#4787)
* Added AxiosHeaders class;

* Fixed README.md href;

* Fixed a potential bug with headers normalization;

* Fixed a potential bug with headers normalization;
Refactored accessor building routine;
Refactored default transforms;
Removed `normalizeHeaderName` helper;

* Added `Content-Length` accessor;
Added missed `has` accessor to TS types;

* Added `AxiosTransformStream` class;
Added progress capturing ability for node.js environment;
Added `maxRate` option to limit the data rate in node.js environment;
Refactored event handled by `onUploadProgress` && `onDownloadProgress` listeners in browser environment;
Added progress & data rate tests for the http adapter;
Added response stream aborting test;
Added a manual progress capture test for the browser;
Updated TS types;
Added TS tests;
Refactored request abort logic for the http adapter;
Added ability to abort the response stream;

* Remove `stream/promises` & `timers/promises` modules usage in tests;

* Use `abortcontroller-polyfill`;

* Fixed AxiosTransformStream dead-lock in legacy node versions;
Fixed CancelError emitting in streams;

* Reworked AxiosTransformStream internal logic to optimize memory consumption;
Added throwing an error if the request stream was silently destroying (without error) Refers to #3966;

* Treat the destruction of the request stream as a cancellation of the request;
Fixed tests;

* Emit `progress` event in the next tick;

* Initial refactoring;

* Refactored Mocha tests to use ESM;

* Refactored Karma tests to use rollup preprocessor & ESM;
Replaced grunt with gulp;
Improved dev scripts;
Added Babel for rollup build;

* Added default commonjs package export for Node build;
Added automatic contributors list generator for package.json;

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-06-18 11:19:27 +02:00
Jay e8dd5cb1ed docs(helpers/AxiosURLSearchParams) 2022-06-02 20:51:32 +02:00
Jay 6f06e25f53 docs(helpers/buildURL) 2022-06-02 20:51:03 +02:00
Jay 18e563d7f8 docs(helpers/combineURLs) 2022-06-02 20:50:41 +02:00
Jay 714daab1e7 docs(helpers/deprecatedMethod) 2022-06-02 20:50:16 +02:00
Jay ff2f0b4bd7 docs(helpers/formDataToJSON) 2022-06-02 20:49:51 +02:00
Jay a0808db951 docs(helpers/fromDataURI) 2022-06-02 20:49:21 +02:00
Jay 10c20daa2b docs(helpers/isAbsoluteURL) 2022-06-02 20:48:55 +02:00
Jay 910a920c55 docs(helpers/isAxiosError) 2022-06-02 20:48:22 +02:00
Jay 0556288a96 docs(helpers/parseHeaders) 2022-06-02 20:47:56 +02:00
Jay 5e2ffa2209 chore(helpers/spread): added docs for spread functions 2022-06-02 20:46:44 +02:00
Jay ba3e593807 chore(helpers/toFormData): added docs for to form data functions 2022-06-02 20:46:05 +02:00
Jay 34b71f0a1c chore(helpers/validator): added docs for validator function 2022-06-02 20:45:27 +02:00
Dmitriy Mozgovoy c008e57fe4 Added axios.formToJSON method; (#4735)
* Draft

* Added `formDataToJSON` helper;
Added `axios.formToJSON` method;
Added client tests;

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-25 08:21:40 +02:00
Dmitriy Mozgovoy 934f390cc3 URL params serializer; (#4734)
* Refactored BuildURL helper to use URLSearchParams serializer;

* Updated typings;
Added TS test;
2022-05-25 08:16:38 +02:00
Dmitriy Mozgovoy 467025bdb7 Fixed bug #4727 : toFormData Blob issue on node>v17; (#4728)
* Fixed bug #4727;
Added node 18.x to the CI;
Added hotfix for `ERR_OSSL_EVP_UNSUPPORTED` issue with karma running on node >=17.x;
Added `cross-env` to allow running build and test scripts on Windows platforms;

* Added conditional setting of `--openssl-legacy-provider` option for node versions >=17.x;

* Refactored ssl-hotfix & test script;

* Fixed and refactored default max body length test due to ECONNRESET failure;

* Added test for converting the data uri to a Blob;
Fixed bug with parsing mime type for Blob;

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-20 16:31:26 +02:00
Dmitriy Mozgovoy c30252f685 Added data URL support for node.js; (#4725)
* Added data URL support for node.js;
Added missed data URL protocol for the browser environment;
Optimized JSON parsing in the default response transformer;
Refactored project structure;
Added `cause` prop for AxiosError instance that refers to the original error if it was wrapped with `AxiosError.from` method;
Added fromDataURI helper;
Added test for handling data:url as an `arraybuffer|text|stream`;

* Added throwing of 405 HTTP error if the method is not GET;
2022-05-20 08:04:36 +02:00
Dmitriy Mozgovoy bd391247b4 Added the ability for the url-encoded-form serializer to respect the formSerializer config; (#4721)
Added test for `formSerializer` config in context of `url-encoded-form` serializer;
2022-05-17 08:26:35 +02:00
Dmitriy Mozgovoy c05ad48952 Fixed toFormData regression bug (unreleased) with Array-like objects serialization; (#4714)
Added `toURLEncodedForm` helper;
Added automatic payload serialization to `application/x-www-form-urlencoded` to have parity with `multipart/form-data`;
Added test of handling `application/x-www-form-urlencoded` body by express.js;
Updated README.md;
Added missed param in JSDoc;
Fixed hrefs in README.md;

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-16 08:30:17 +02:00
Dmitriy Mozgovoy 807918bda2 Added enhanced toFormData implementation with additional options support; (#4704)
Updated default notation for arrays and objects to bracket style;
Added `multer/express.js` tests;
Updated README.md;

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-11 19:30:08 +02:00
暴走老七 4c898f8665 don\'t need to transform arguments to array (#4544)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-09 19:08:57 +02:00
JALAL eef2f97281 replace deprecated substr() with slice() (#4468)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-03 21:39:40 +02:00
Jingyi Lin ba85e0e385 style: fix word spelling ang lint style in comment (#4500)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-03 21:12:16 +02:00
Dmitriy Mozgovoy b9e9fb4fa0 Enhanced protocol parsing implementation to fix #4633; (#4639)
Added unit tests;

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-04-27 11:30:50 +02:00
Jay 3e0954db22 Fixed merge conflicts 2022-04-01 20:41:47 +02:00
Jay 8699891b8e Fixed merge conflicts 2022-04-01 18:40:12 +02:00
Dmitriy Mozgovoy 6b9b05b907 Improved FormData support; (#4448)
* Fixed isFormData predicate;
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;

* Added the `form-data` package as a dependency for the server build;
Added tests for FormData payload;

* Added FormData automatic serialization section;
Refactored cancellation section;

* Reworked toFormData helper;
Expose toFormData helper as a static method;
Refactored transform request;
Added kindOf, kindOfTest, endsWith, isTypedArray util;
Refactored utils.js to use kindOf for tests;

* 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 using `form-data` package;

(cherry picked from commit 73e3bdb883)

* Added shortcut methods `postForm`, `putForm`, `patchForm` to submit a Form;
Added ability to submit FileList object as a FormData;
Updated README.md;

* Updated README.md;
2022-03-14 20:22:10 +02:00