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

114 Commits

Author SHA1 Message Date
Dmitriy Mozgovoy 5a3d0a3234 fix(types): fixed CommonRequestHeadersList & CommonResponseHeadersList types to be private in commonJS; (#5503) 2023-01-28 15:58:56 +02:00
Dmitriy Mozgovoy 580f1e8033 fix(types): fixed AxiosHeaders to handle spread syntax by making all methods non-enumerable; (#5499) 2023-01-26 16:01:06 +02:00
Dmitriy Mozgovoy 2a71f49bc6 fix(types): renamed RawAxiosRequestConfig back to AxiosRequestConfig; (#5486) 2023-01-23 01:09:18 +02:00
Dmitriy Mozgovoy 6486929f70 Fix AxiosRequestHeaders & AxiosHeaders types; (#5482) 2023-01-21 17:31:24 +02:00
Daniel Hillmann 186ea062da fix AxiosRequestConfig generic (#5478)
pass AxiosRequestConfig generic D to RawAxiosRequestConfig
2023-01-19 08:57:38 +02:00
Dmitriy Mozgovoy 08119634a2 fix(types): fixed AxiosRequestConfig header interface by refactoring it to RawAxiosRequestConfig; (#5420) 2023-01-06 02:02:08 +02:00
Dmitriy Mozgovoy 7a2f901f42 Fix/typescript tests (#5375)
* chore(ci): Add release-it script;

* chore(ci): add `release:no-npm` script to release the package without making an npm release;

* fix(test): fixed `d.ts` typings;
refactor(test): refactor typescript tests;
2022-12-14 22:49:49 +02:00
Dmitriy Mozgovoy a6efeaf2d9 Change AxiosProgressEvent.event type to any; (#5308)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-12-01 21:03:58 +02:00
Philipp Loose 6f59cdbac9 refactor: add missing types for static AxiosError.from method (#4956)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-12-01 20:36:42 +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
Dmitriy Mozgovoy d032edda08 Refactored adapters loader; (#5277)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-11-22 20:53:56 +02:00
Remco Haszing abf954185a fix: fix TypeScript type definitions for commonjs (#5196)
This is done by duplicating `index.d.ts` into `index.d.cts`, and
modifying it for CommonJS. The same was done for type tests.

Unfortunately I was unable to find a way to re-use types without
drastically changing the code base.

To test this, a minimum TypeScript version of 4.7 is needed, so it has
been updated. The old types still work with older TypeScript versions.

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-11-10 20:23:02 +02:00
Dmitriy Mozgovoy ab77a40e1c Fixed & Imporoved AxiosHeaders class (#5224)
* Refactored AxiosHeaders class;

* Added support for instances of AxiosHeaders as a value for the headers option;

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-11-07 21:11:42 +02:00
Dmitriy Mozgovoy 9452f06aa9 Force CI restart;
Force CI restart;
2022-11-07 20:24:23 +02:00
Amit Saini 448e1fcdec Fixed type definition of use method on AxiosInterceptorManager to match the the README (#5071)
* fixed type definition use method on AxiosInterceptorManager to match the README

* fixed parentheses issues with type

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-10-30 19:06:29 +02:00
Dmitriy Mozgovoy 0c3a1e9fde Refactored module exports; (#5162)
* Refactored build pipeline;
Added module exports tests;
Added missing ESM export for parity with Axios factory;
Added `toFormData`, `formToJSON`, `isAxiosError`, `spread`, `isCancel`, `all` as named export to `index.d.ts`;

* Added ESM entry test;

* Updated README.md `installing` section;

* Added TypeScript importing test;
Added missed `CanceledError` & `AxiosHeaders` to `AxiosStatic` interface;

* Exclude `/test/module/` from tslint;
2022-10-30 18:46:17 +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
Salman Shaikh ed19414b33 fix: added AxiosHeaders in AxiosHeaderValue (#5103)
fixes issue #5034

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-10-13 22:00:05 +02:00
Dmitriy Mozgovoy 110ae9ae61 fix: handling of array values for AxiosHeaders (#5085)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-10-13 21:11:01 +02:00
shingo.sasaki a6e40c3bb2 fix(type): add clear to AxiosInterceptorManager (#5010)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-10-06 08:16:27 +02:00
Dmitriy Mozgovoy e757e0e572 Make onabort&addEventListener&removeEventListener of GenericAbortSignal interface optional; (#5021) 2022-10-06 08:09:45 +02:00
Marco Weber 0959c5cbbb Improve typing of timeout in index.d.ts (#4934)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-09-28 21:09:57 +02:00
mia-z b5ea1dc009 feat: add enum containing Http Status Codes to typings. (#4903)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-09-28 20:42:00 +02:00
Stephen Jennings 64906bd886 require interceptors to return values (#4874)
Fixes #4873

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-09-26 21:11:29 +02:00
Günther Foidl b0710bf8a2 SerializerOptions.indexes allows boolean | null | undefined (#4862)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-09-26 20:26:32 +02:00
hcwhan ce8a9211b6 fix type error (#4815)
AxiosPromise is contains AxiosResponse and the `R` is AxiosResponse

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-09-14 21:18:39 +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
Dmitriy Mozgovoy a02fe284df Updated README.md; (#4742)
Updated index.d.ts;

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-26 08:13: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
Johann Cooper de973f00f3 Adding types for progress event callbacks (#4675)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-20 09:18:56 +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
chenjigeng 63e559fa60 fix: add isCancel type assert (#4293)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-18 07:38:52 +02:00
Kirill Shakirov e6f9026d51 Fixing AxiosRequestHeaders typings (#4334)
Co-authored-by: Shakirov Kirill <ksshakirov@sberautotech.ru>
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-16 09:33:36 +02:00
Rraji Abdelbari ee51e68143 add string[] to AxiosRequestHeaders type (#4322)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-16 09:21:56 +02:00
Jelle Schutter ed0ba0fd60 allow type definition for axios instance methods (#4224)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-16 09:08:02 +02:00
Dmitriy Mozgovoy 65b92958ae Fixed AxiosError status code type; (#4717)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-16 08:51:22 +02:00
毛呆 e762cf77b3 Adding Canceler parameters config and request (#4711)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-16 08:19:46 +02:00
Adrian Wieprzkowicz 13dd93f6c5 Expand isAxiosError types (#4344)
* Expand isAxiosError types

* Fix isAxiosError types

Add missing generic type variable

* Fix typo

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-12 09:19:07 +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
Lukas Hroch ac96144dd3 fix(types): allow to specify partial default headers for instance creation (#4185)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-09 20:03:05 +02:00
Koki Oyatsu 2f50c8249b Adding HTTP status code for transformResponse (#4580)
* Adding HTTP status code for transformResponse

* refs #1214

* Fix wrong argument for tranformResponse

* Fix test wrong argument for tranformData

* Add test case for transformData

* Add test case for transformData (reference headers case)

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-09 19:25:16 +02:00
Spencer 9f6ba5ee43 Fixing instance.defaults.headers type (#4557)
* Fixing instance.defaults.headers type

* remove console.log()

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-09 19:12:53 +02:00
Dmitriy Mozgovoy 384b7e6994 Added generic AxiosAbortSignal TS interface to avoid importing AbortController polyfill (#4229)
* Added generic `AxiosAbortSignal` TS interface to avoid importing AbortController polyfill;

* Renamed `AxiosAbortSignal` to `GenericAbortSignal` to use the same naming style as `GenericFormData`;

* Added TS test for `GenericAbortSignal` interface;

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-04 21:23:01 +02:00
Brian Helba eaaab30442 Fix TS definition for AxiosRequestTransformer (#4201)
The callback `AxiosRequestTransformer` can always expect its `headers`
parameter to be defined. This is ensured immediately before the callback
is made.
See: https://github.com/axios/axios/blob/1025d1231a7747503188459dd5a6d1effdcea928/lib/core/dispatchRequest.js#L32-L40

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-04 21:18:57 +02:00
Philipp Loose 3479ca7c76 Updating typing for AxiosPromise (#4505)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-03 21:07:09 +02:00
Dmitriy Mozgovoy c07998a621 Added generic TS types for the exposed toFormData helper; (#4668) 2022-05-03 20:29:50 +02:00
Michael Li 8213da4f16 fix(type): add AxiosError to AxiosStatic (#4654)
https://github.com/axios/axios/blob/master/lib/axios.js#L47

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-03 18:43:37 +02:00
Bertrand Marron 205bd0f01d Make AxiosError.config optional in the type definition (#4665)
It is optional in the constructor, and not always defined.

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-03 18:37:51 +02:00