Commit Graph

46 Commits

Author SHA1 Message Date
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
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
Andrew Gibb
4f1101fe4b Fixing isArrayLike to allow length as a param. Added test 2015-07-21 14:29:24 +10: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
6d03e0bd4e Fixing issues with strict mode
closes #45
2015-03-10 14:28:43 -06:00
Niklas Närhinen
2f4d0b8b45 Automatic Content-Type for FormData uploads
When data passed to axios is of type FormData we have to let the browser
create the Content-Type header so that the boundaries will get right
etc.

Usage:

```js
var data = new FormData();
data.append('field', 'some string');
data.append('file', someFile);

var opts = {
  transformRequest: function(data) { return data; }
};

axios.post('/fileupload', data, opts);

```
2014-10-23 01:49:25 +03:00
mzabriskie
f406b092fc Fixing failing tests 2014-09-22 10:47:41 -06:00
Mathieu Bruyen
095a204c5b Allow ArrayBuffer and related views as data
In order to push binary data under the form of ArrayBuffer and
its related views (Int8Array, ...) one needs not to stringify
those.

For the XHR adapter there is nothing to do as it natively supports
ArrayBuffer in req.send().

Node's http adapter supports only string or Buffer thus a
transformation to Buffer is required before setting content length
header.
2014-09-18 09:17:46 +02:00
Matt Zabriskie
7aef479c7e Adding xsrf protection 2014-08-29 01:17:40 -06:00
Matt Zabriskie
cec3482ff7 Moving utility functions into utils 2014-08-28 12:33:53 -06:00