Commit Graph

94 Commits

Author SHA1 Message Date
Ivan Churakov
6cbd79b83a
fix: correct AxiosInstance call signature for typed responses (#7328)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2026-02-23 20:12:12 +02:00
Gabe Mendoza
c01062253a
feat: add type for allowAbsoluteUrls (#6849) 2025-03-25 20:28:04 +02:00
briwa
111811eadc
fix(backport): custom params serializer support (#6263) 2024-03-28 18:54:20 +02:00
Dmitriy Mozgovoy
27c007656d
feat(backport): added ability for paramsSerializer to handle function; (#6227) 2024-02-12 20:05:36 +02:00
lnjbr
2755df562b
fix(security): fixed CVE-2023-45857 by backporting withXSRFToken option to v0.x (#6091) 2024-01-19 18:33:41 +02:00
Willian Agostini
c4bf0a4afc
Allow null indexes on formSerializer and paramsSerializer v0.x (#4961)
* test: Failed test

Param indexes from formSerializer and paramsSerializer receiving null

Closes #4959

* fix: Allow null to indexes in SerializerOptions

Closes #4959

Co-authored-by: Willian Agostini <willian.agostini@fleetcor.com.br>
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-09-29 08:19:45 +02:00
Willian Agostini
1e2679f75b
fix: [Types] Type of header in AxiosRequestConfig / for Axios.create is incorrect (#4927)
* test: Fail test to #4911

Type of header in AxiosRequestConfig / for Axios.create is incorrect

* fix: Type of header in AxiosRequestConfig is incorrect

Add new type for MethodsHeaders in AxiosRequestHeaders

Closes #4911

* refactor: Remove interface to add type #4927

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-09-28 21:05:07 +02:00
Gabriel Proust
bbb2264614
fix(typing): axios response headers can be undefined (#4813)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-08-10 20:43:18 +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: 1025d1231a/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
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
Jay
340ad9ec8c Fixed merge conflict 2022-03-09 19:57:04 +02:00
Jay
d8d43c1ffd Mended merge conflicts 2022-03-09 19:41:56 +02:00
Rijk van Zanten
8e67551177
Update line on methods, update TS definition to allow strings (#3802)
Fixes #3140

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-03-08 08:26:07 +02:00
Tommaso Madonia
224ed940e1
Add AxiosInterceptorOptions to d.ts (#3800)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-03-07 20:26:50 +02:00
Zoran Kokeza
412d3bd607
Adding support for beforeRedirect config option (#3852)
* Adding support for beforeRedirect config option

* Adding tests for beforeRedirect

* Update README.md

Co-authored-by: Prabodh Meshram <prabodh.meshram7@gmail.com>

* fix types

Co-authored-by: Prabodh Meshram <prabodh.meshram7@gmail.com>
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-03-07 19:46:08 +02:00
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
Felipe Carvalho
4fbf61dc75
Adding responseEncoding prop type in AxiosRequestConfig (#3918)
* Adding responseEncoding prop type in AxiosRequestConfig

* Update index.d.ts

Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-12-23 19:07:46 +02:00
Stefano Magni
5431634fab
Fixing Cancel' signature. (#3152) (#3153)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-12-22 20:30:50 +02:00
Brandon Faulkner
6b4fd93e68
Expand Headers types (#4144)
* Expand Headers types

* Add undefined to allowed types

* Add semicolon
2021-11-16 17:06:21 +02:00
Rodry
2c9cc76ee9
revert: change type of AxiosResponse to any (#4186)
* revert: change type of AxiosResponse to any

* types: add back default types

My bad xD

* Remove redundant default params
2021-10-22 10:14:23 +02:00
DigitalBrainJS
7f1236652a Refactored AxiosError to a constructor;
Refactored `Cancel` to a constructor, a subclass of the `AxiosError`;
Expose CanceledError class;
Refactored axios error codes;
Added `toFlatObject` util;
2021-10-14 19:15:16 +03:00
Remco Haszing
94a9344799
Test types (#4140)
* Distinguish request and response data types

* Fix Axios headers type

`axios.headers` is not of the same type as `request.headers`, so a new type
`AxiosDefaults` was introduced

* Replace grunt-ts with dtslint

This asserts that the type definitions are valid in the specified TypeScript
version and above. This is the same tool that is used by DefinitelyTyped.

* Remove grunt-ts

* Restore typescript dependency

* Fix missing semicolons

Co-authored-by: Claas Augner <github@caugner.de>
Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-10-12 09:53:10 +02:00
Dmitriy Mozgovoy
fce210a67e
Fixed TransitionalOptions typings (#4147)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-10-12 09:46:16 +02:00
Jay
547815d9fd Mending merge conflict 2021-10-12 09:43:02 +02:00
Evgeniy
e462973a4b
fix response headers types (#4136)
* fix response headers types

some keys like 'set-cookie' are arrays https://github.com/axios/axios/blob/master/lib/helpers/parseHeaders.js#L45

* split header types
2021-10-07 19:23:29 +02:00
Claas Augner
7c9a5c5c84
Fix missing semicolon in typings (#4115)
Fixes #4109.

Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-10-06 21:11:00 +02:00
Remco Haszing
6c002323a6
Change never type to unknown (#4142)
* Distinguish request and response data types

* Change never type to unknown

Using `never` was a workaround I introduced in 3002, because `unknown` wasn’t
supperted by all relevant versions of TypeScript at the time. It is now, and
it is much more correct.

Co-authored-by: Claas Augner <github@caugner.de>
Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-10-06 20:13:06 +02:00