Commit Graph

59 Commits

Author SHA1 Message Date
Guillaume Masclet
62610f69ad
fix: fixed performance issue in isEmptyObject() (#6484)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2026-04-07 21:29:38 +02:00
Felix Bernhard
d7ff1409c6
fix: backport DOS via __proto__ key in merge config fix to v0.x (#7388)
* backport fix

* add unit tests

* use `require()` instead of `import`
2026-02-11 08:19:32 +02:00
Willian Agostini
80b546c3f1
fix: loosing request header (#4858) (#4871)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-09-26 21:05:57 +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
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
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
Cat Scarlet
5affc9d08e
Updating trim() polyfill. According to mdn: cf607d6852/files/en-us/web/javascript/reference/global_objects/string/trim/index.md (#4072)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-04 20:25:23 +02:00
Dmitriy Mozgovoy
4f7e3e3a7a
Removed import of url module in browser build due to significant size overhead; (#4594)
Removed pointless `Malformed URL` checking in  client build;
2022-04-26 09:08:49 +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
João Gabriel Quaresma
195c8e5ff5
Returned error treated when requesting uncommon URL (#3544)
* Fixing error returned when requesting illegal URL

* Adding unit tests http.js

* Fixing error message axios invalid request from browser

* Adding unit tests requests.spec.js

* Adding at utils.js a new method: getProtocol

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-03-07 19:53:57 +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
C. Lewis
a76571abec
Use native Array.isArray() in utils.js (#3836)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-12-23 18:45:44 +02:00
enofan
716d5def2f
Update utils.js (#3342)
update isFormdata,isArrayBuffer and isURLSearchParams, because value and Formdata(ArrayBuffer or URLSearchParams) are not the same Window sometimes.

Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-12-22 20:37:27 +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
ready-research
5b457116e3
Security fix for ReDoS (#3980) 2021-08-30 14:33:43 +02:00
Daniel Lopretto
59ab559386
Update dev dependencies (#3401)
- Everything still works as expected.
  - Remove bundlesize
    - It still uses libtorb which is deprecated and broken on Win and
      requires a full suite of build tools on Mac. Keeping it in the
      package makes it difficult for anyone filing issues to run tests.
    - See: #3396
  - Update grunt and it's plugins
  - Update karma to v4...so much faster!
    - Changed the karma config. Better changes: #3394
  - Update Webpack
    - Uses terser over uglify
  - Update eslint
    - Caused an error in util.js from the `global` directive so the
      directive is removed (it was not needed).
  - Update typescript
    - The old version of tsc didn't know about new features in
      @types/node (like `asserts value`).

Co-authored-by: Jay <jasonsaayman@gmail.com>
2020-12-16 10:25:06 +02:00
Cr
16aa2ce7fa
Fixing response with utf-8 BOM can not parse to json (#2419)
* fix: remove byte order marker (UTF-8 BOM) when transform response

* fix: remove BOM only utf-8

* test: utf-8 BOM

* fix: incorrect param name

Co-authored-by: Jay <jasonsaayman@gmail.com>
2020-07-01 19:14:52 +02:00
Xianming Zhong
0d69a79c81
Refactor mergeConfig without utils.deepMerge (#2844)
* Adding failing test

* Fixing #2587 default custom config persisting

* Adding Concat keys and filter duplicates

* Fixed value from CPE

* update for review feedbacks

* no deepMerge

* only merge between plain objects

* fix rename

* always merge config by mergeConfig

* extract function mergeDeepProperties

* refactor mergeConfig with all keys, and add special logic for validateStatus

* add test for resetting headers

* add lots of tests and fix a bug

* should not inherit `data`

* use simple toString

* revert #1845

Co-authored-by: David Tanner <david.tanner@lifeomic.com>
Co-authored-by: Justin Beckwith <justin.beckwith@gmail.com>
2020-06-08 20:52:45 +02:00
Martti Laine
487941663b
Allow unsetting headers by passing null (#382) (#1845)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2020-06-04 20:57:54 +02: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
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
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
Martti Laine
82030ae054 Use deepMerge in deepMerge 2018-04-03 21:53:17 +02:00
Martti Laine
72c66dfdec Refactor and introduce deepMerge 2018-03-23 20:21:02 +01:00
Martti Laine
d78204712a Clean up PR 2018-03-09 13:58:08 +02:00
Martti Laine
5bfd2ea9f6 Fixing #385 - Keep defaults local to instance 2018-03-02 12:31:15 +02:00
Clark Du
63548c00c0
refactor: !isArray(obj) is always true 2017-11-01 15:47:58 +08:00
Felix Gnass
c82753ce54 Use is-buffer instead of Buffer.isBuffer
The is-buffer module checks if an object is a Buffer without causing
Webpack or Browserify to include the whole Buffer module in the bundle.
2017-05-04 23:41:52 +02:00
Jeremy Fowler
188334439f support node buffers less than 8192 bytes (#773) 2017-04-08 13:55:34 +02:00
Nick Uraltsev
5df39d8fa0 Check that navigator is defined 2017-03-01 21:52:42 -08:00
Viktor
603bd2f66c added proper detection of react-native in isStandardBrowserEnv function 2017-02-25 12:14:43 +01:00
Nick Uraltsev
4c4e648f40 Replacing Object.hasOwnProperty with Object.prototype.hasOwnProperty 2016-09-12 11:26:40 -07:00
Tony L. Kerz
077153a0a7 [for-each] has-own-prop issue node 2016-09-11 09:15:22 -04:00
Matt Zabriskie
0e2f4f1417 Moving Axios class into core/ 2016-06-01 14:42:14 -06:00
Matt Zabriskie
112f98dc18 Merge pull request #317 from nickuraltsev/urlsearchparams
Adding support for URLSearchParams
2016-05-24 20:40:25 -06:00
Nick Uraltsev
2b8d89a65e Modifying isURLSearchParams function to use instanceof instead of duck typing 2016-05-18 18:47:34 -07:00
Sergey Tsvetkov
b1e6e753ff Used instanceof to determine FormData in utils.isFormData. Fix #323. 2016-05-17 15:52:15 +03:00
Nick Uraltsev
f20490eb6b Adding support for URLSearchParams 2016-05-07 12:26:28 -07:00
Nick Uraltsev
9e7b1b5993 Add isFunction and isStream helpers 2016-04-12 19:49:12 -07:00
Matt Zabriskie
82847f737e Fixing config weirdness 2015-12-24 11:44:46 -07:00
Matt Zabriskie
f28a4a8248 Using more strict eslint rules 2015-12-14 20:06:57 -07:00
Colin Timmermans
1e2cb9bdca Don't use utils.forEach to loop over arguments
This fixes IE8 support, where we cannot relialably detect an arguments
object.
2015-10-27 23:26:04 +01:00
mzabriskie
6aa766e5e9 Adding support for web workers, and react-native
closes #70, closes #98
2015-09-28 18:33:46 -06:00