@openclaw/slack 2026.7.2-beta.2 → 2026.7.2-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{account-configured-DzC407uv.js → account-configured-BwfXBo_F.js} +1 -1
- package/dist/account-inspect-api.js +1 -1
- package/dist/{account-inspect-Di7ditqZ.js → account-inspect-jn1xLaVi.js} +9 -2
- package/dist/account-reply-mode-DrUXogvO.js +14 -0
- package/dist/{accounts-BOJJiHSr.js → accounts-BSr252c_.js} +13 -25
- package/dist/accounts.runtime-CjULMLTa.js +2 -0
- package/dist/{action-runtime-Cee2ih0s.js → action-runtime-CFU52n4W.js} +11 -17
- package/dist/action-runtime.runtime-9-17zvKH.js +2 -0
- package/dist/{actions-BZiuSTIq.js → actions-D51foiwR.js} +5 -5
- package/dist/{actions.runtime-DoD0-gxw.js → actions.runtime-BMJwtf5C.js} +1 -1
- package/dist/api.js +15 -15
- package/dist/{approval-handler.runtime-CUPtIM4k.js → approval-handler.runtime-3b4-wxMl.js} +2 -2
- package/dist/{channel-DaIiGUOp.js → channel-Ds8NKvfr.js} +75 -41
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-type-Cfm6_6n1.js → channel-type-DXkUajFP.js} +3 -3
- package/dist/{channel.setup-C-mLz50O.js → channel.setup-DOSTEDfA.js} +8 -5
- package/dist/{config-schema-xPSnK2VK.js → config-schema-B4j4tCOI.js} +236 -30
- package/dist/{directory-config-DRkFujwG.js → directory-config-B08pm5ZT.js} +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-D_yZhjgp.js → directory-live-DpPKzPrn.js} +2 -2
- package/dist/doctor-contract-U6oVntbM.js +173 -0
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{group-policy-85UWiriS.js → group-policy-CdnQzQBI.js} +98 -125
- package/dist/{interactive-replies-BilWUdcI.js → interactive-replies-C3ffk6oN.js} +1 -1
- package/dist/interactive-replies-api.js +1 -1
- package/dist/{message-tool-api-CA9jZrCY.js → message-tool-api-ByVyIVOh.js} +3 -3
- package/dist/message-tool-api.js +1 -1
- package/dist/{monitor-CalGciTs.js → monitor-CnB_WKvF.js} +3 -3
- package/dist/{outbound-adapter-BiLKcnyH.js → outbound-adapter-DuPz2HHt.js} +49 -5
- package/dist/{pipeline.runtime-DofAvTtb.js → pipeline.runtime-5rRYZuX5.js} +490 -345
- package/dist/{policy-BVs4LiSa.js → policy-C31RYSuT.js} +1 -1
- package/dist/probe-CVRuArHA.js +340 -0
- package/dist/{provider-CmeoUiIM.js → provider-htuIJGFD.js} +791 -359
- package/dist/{relay-source-DMmgtvg4.js → relay-source-Df9EaiTF.js} +6 -11
- package/dist/{replies-CJJCp6qz.js → replies-Cgr2Gli4.js} +3 -3
- package/dist/{resolve-channels-Rfts6POK.js → resolve-channels-DodP2TFx.js} +1 -1
- package/dist/{resolve-users-y6wAxR8E.js → resolve-users-M9eF8891.js} +1 -1
- package/dist/{runtime-api-BGDyOt1D.js → runtime-api-D5XYMMsf.js} +3 -2
- package/dist/runtime-api.js +11 -11
- package/dist/{scopes-CuxNQZ6v.js → scopes-CJRpHkDC.js} +1 -2
- package/dist/{secret-contract-CMohXFWS.js → secret-contract-DxmvbxBF.js} +1 -0
- package/dist/secret-contract-api.js +1 -1
- package/dist/{security-audit-CikQhBUY.js → security-audit-Cz6erklv.js} +0 -10
- package/dist/security-contract-api.js +1 -1
- package/dist/{send-DYp8ca-l.js → send-BZ1tPv7-.js} +28 -11
- package/dist/send.runtime-a2pilFor.js +2 -0
- package/dist/setup-core-tPxMuFez.js +600 -0
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-oSd3NX9J.js → setup-surface-wV-S1dE_.js} +58 -32
- package/dist/{shared-D9yz5Otg.js → shared-BfMskaMx.js} +57 -10
- package/dist/{slash-dispatch.runtime-CSja9VuD.js → slash-dispatch.runtime-lfeIsXTX.js} +1 -1
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/fs/promises.d.ts +16 -6
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/agent-base/README.md +145 -0
- package/node_modules/agent-base/dist/src/index.d.ts +78 -0
- package/node_modules/agent-base/dist/src/index.js +203 -0
- package/node_modules/agent-base/dist/src/index.js.map +1 -0
- package/node_modules/agent-base/dist/src/promisify.d.ts +4 -0
- package/node_modules/agent-base/dist/src/promisify.js +18 -0
- package/node_modules/agent-base/dist/src/promisify.js.map +1 -0
- package/node_modules/agent-base/package.json +64 -0
- package/node_modules/agent-base/src/index.ts +345 -0
- package/node_modules/agent-base/src/promisify.ts +33 -0
- package/node_modules/axios/CHANGELOG.md +197 -1
- package/node_modules/axios/README.md +424 -256
- package/node_modules/axios/dist/axios.js +589 -204
- package/node_modules/axios/dist/axios.min.js +3 -3
- package/node_modules/axios/dist/axios.min.js.map +1 -1
- package/node_modules/axios/dist/browser/axios.cjs +630 -185
- package/node_modules/axios/dist/esm/axios.js +630 -185
- package/node_modules/axios/dist/esm/axios.min.js +2 -2
- package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
- package/node_modules/axios/dist/node/axios.cjs +949 -301
- package/node_modules/axios/index.d.cts +28 -5
- package/node_modules/axios/index.d.ts +24 -3
- package/node_modules/axios/lib/adapters/adapters.js +1 -1
- package/node_modules/axios/lib/adapters/fetch.js +223 -49
- package/node_modules/axios/lib/adapters/http.js +408 -193
- package/node_modules/axios/lib/adapters/xhr.js +3 -1
- package/node_modules/axios/lib/core/Axios.js +4 -2
- package/node_modules/axios/lib/core/AxiosError.js +13 -1
- package/node_modules/axios/lib/core/AxiosHeaders.js +13 -42
- package/node_modules/axios/lib/core/buildFullPath.js +29 -1
- package/node_modules/axios/lib/core/mergeConfig.js +35 -0
- package/node_modules/axios/lib/defaults/transitional.js +2 -0
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +1 -3
- package/node_modules/axios/lib/helpers/Http2Sessions.js +119 -0
- package/node_modules/axios/lib/helpers/buildURL.js +7 -4
- package/node_modules/axios/lib/helpers/composeSignals.js +48 -47
- package/node_modules/axios/lib/helpers/cookies.js +5 -1
- package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +16 -11
- package/node_modules/axios/lib/helpers/formDataToJSON.js +26 -4
- package/node_modules/axios/lib/helpers/formDataToStream.js +2 -2
- package/node_modules/axios/lib/helpers/fromDataURI.js +20 -5
- package/node_modules/axios/lib/helpers/progressEventReducer.js +3 -0
- package/node_modules/axios/lib/helpers/resolveConfig.js +26 -13
- package/node_modules/axios/lib/helpers/sanitizeHeaderValue.js +60 -0
- package/node_modules/axios/lib/helpers/shouldBypassProxy.js +33 -1
- package/node_modules/axios/lib/helpers/toFormData.js +48 -12
- package/node_modules/axios/lib/helpers/validator.js +1 -1
- package/node_modules/axios/lib/utils.js +105 -19
- package/node_modules/axios/package.json +31 -13
- package/node_modules/https-proxy-agent/README.md +137 -0
- package/node_modules/https-proxy-agent/dist/agent.d.ts +30 -0
- package/node_modules/https-proxy-agent/dist/agent.js +177 -0
- package/node_modules/https-proxy-agent/dist/agent.js.map +1 -0
- package/node_modules/https-proxy-agent/dist/index.d.ts +23 -0
- package/node_modules/https-proxy-agent/dist/index.js +14 -0
- package/node_modules/https-proxy-agent/dist/index.js.map +1 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +7 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.js +66 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -0
- package/node_modules/https-proxy-agent/package.json +56 -0
- package/node_modules/iconv-lite/encodings/sbcs-data.js +2 -0
- package/node_modules/iconv-lite/encodings/utf32.js +10 -3
- package/node_modules/iconv-lite/package.json +2 -2
- package/node_modules/iconv-lite/types/encodings.d.ts +2 -0
- package/node_modules/path-to-regexp/Readme.md +3 -3
- package/node_modules/path-to-regexp/dist/index.js +135 -158
- package/node_modules/path-to-regexp/dist/index.js.map +1 -1
- package/node_modules/path-to-regexp/package.json +2 -2
- package/node_modules/qs/CHANGELOG.md +11 -0
- package/node_modules/qs/dist/qs.js +17 -17
- package/node_modules/qs/lib/parse.js +19 -8
- package/node_modules/qs/lib/utils.js +47 -8
- package/node_modules/qs/package.json +6 -5
- package/node_modules/qs/test/parse.js +230 -0
- package/node_modules/qs/test/utils.js +194 -0
- package/node_modules/typebox/build/compile/validator.d.mts +1 -4
- package/node_modules/typebox/build/guard/guard.d.mts +1 -1
- package/node_modules/typebox/build/guard/guard.mjs +5 -2
- package/node_modules/typebox/build/guard/string.mjs +16 -4
- package/node_modules/typebox/build/schema/engine/_functions.mjs +34 -15
- package/node_modules/typebox/build/type/action/readonly_object.d.mts +5 -0
- package/node_modules/typebox/build/type/action/readonly_object.mjs +8 -0
- package/node_modules/typebox/build/typebox.d.mts +1 -1
- package/node_modules/typebox/build/typebox.mjs +1 -1
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +29 -32
- package/node_modules/ws/lib/receiver.js +15 -32
- package/node_modules/ws/lib/websocket-server.js +4 -4
- package/node_modules/ws/lib/websocket.js +4 -4
- package/node_modules/ws/package.json +5 -1
- package/npm-shrinkwrap.json +54 -27
- package/openclaw.plugin.json +1331 -1424
- package/package.json +92 -14
- package/dist/accounts.runtime-KvftRRek.js +0 -2
- package/dist/action-runtime.runtime-DZfd7IFr.js +0 -2
- package/dist/client-WIPAS3Yr.js +0 -160
- package/dist/config-api-Df9a1B8C.js +0 -3
- package/dist/doctor-contract-DddfkMlF.js +0 -134
- package/dist/probe-CN0ssfLN.js +0 -48
- package/dist/send.runtime-CJLxAt26.js +0 -2
- package/dist/setup-core-CkwVLzFO.js +0 -337
- package/node_modules/axios/dist/axios.js.map +0 -1
- package/node_modules/axios/dist/browser/axios.cjs.map +0 -1
- package/node_modules/axios/dist/esm/axios.js.map +0 -1
- package/node_modules/axios/dist/node/axios.cjs.map +0 -1
|
@@ -29,27 +29,10 @@
|
|
|
29
29
|
</td>
|
|
30
30
|
<td align="center" width="50%">
|
|
31
31
|
<a
|
|
32
|
-
href="https://
|
|
33
|
-
style="padding: 10px; display: inline-block"
|
|
32
|
+
href="https://opencollective.com/axios/contribute"
|
|
34
33
|
target="_blank"
|
|
34
|
+
>💜 Become a sponsor</a
|
|
35
35
|
>
|
|
36
|
-
<img
|
|
37
|
-
width="90px"
|
|
38
|
-
height="90px"
|
|
39
|
-
src="https://images.opencollective.com/hopper-security/c4f7de2/avatar.png"
|
|
40
|
-
alt="Hopper Security"
|
|
41
|
-
/>
|
|
42
|
-
</a>
|
|
43
|
-
<p align="center">
|
|
44
|
-
Hopper provides a secure, open-source registry where every component is verified against malware and continuously remediated for vulnerabilities across all versions. In simple terms, Hopper removes the need to manage software supply chain risk altogether.
|
|
45
|
-
</p>
|
|
46
|
-
<p align="center">
|
|
47
|
-
<a
|
|
48
|
-
href="https://hopper.security/?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship"
|
|
49
|
-
target="_blank"
|
|
50
|
-
><b>hopper.security</b></a
|
|
51
|
-
>
|
|
52
|
-
</p>
|
|
53
36
|
</td>
|
|
54
37
|
</tr>
|
|
55
38
|
</table>
|
|
@@ -142,7 +125,7 @@
|
|
|
142
125
|
</a>
|
|
143
126
|
<p
|
|
144
127
|
align="center"
|
|
145
|
-
title="Hi, we're Descope! We are building something in the authentication space for app developers and can
|
|
128
|
+
title="Hi, we're Descope! We are building something in the authentication space for app developers and can't wait to place it in your hands."
|
|
146
129
|
>
|
|
147
130
|
Reduce user friction, prevent account takeover, and get a 360° view of your customer and agentic identities with the Descope External IAM platform.
|
|
148
131
|
</p>
|
|
@@ -244,14 +227,13 @@
|
|
|
244
227
|
width="71px"
|
|
245
228
|
height="70px"
|
|
246
229
|
src="https://images.opencollective.com/buzzoid-buy-instagram-followers/56a09fe/logo.png"
|
|
247
|
-
alt="Buzzoid"
|
|
230
|
+
alt="Buzzoid - Buy Instagram Followers"
|
|
248
231
|
/>
|
|
249
232
|
</a>
|
|
250
233
|
<p
|
|
251
234
|
align="center"
|
|
252
235
|
>
|
|
253
|
-
|
|
254
|
-
platform
|
|
236
|
+
At Buzzoid, you can buy Instagram followers through a short checkout flow with safety controls. Rated world's #1 IG service since 2012.
|
|
255
237
|
</p>
|
|
256
238
|
<p align="center">
|
|
257
239
|
<a
|
|
@@ -263,22 +245,59 @@
|
|
|
263
245
|
</td>
|
|
264
246
|
<td align="center" width="33.333333333333336%">
|
|
265
247
|
<a
|
|
266
|
-
href="https://
|
|
248
|
+
href="https://twicsy.com/buy-instagram-followers/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
|
|
249
|
+
style="padding: 10px; display: inline-block"
|
|
267
250
|
target="_blank"
|
|
268
|
-
>💜 Become a sponsor</a
|
|
269
251
|
>
|
|
252
|
+
<img
|
|
253
|
+
width="71px"
|
|
254
|
+
height="70px"
|
|
255
|
+
src="https://images.opencollective.com/buy-instagram-followers-twicsy/b4c5d7f/logo/256.png?height=256"
|
|
256
|
+
alt="Buy Instagram Followers Twicsy"
|
|
257
|
+
/>
|
|
258
|
+
</a>
|
|
259
|
+
<p
|
|
260
|
+
align="center"
|
|
261
|
+
>
|
|
262
|
+
Buy real Instagram followers from Twicsy. Twicsy has been voted the best site to buy followers from the likes of US Magazine.
|
|
263
|
+
</p>
|
|
264
|
+
<p align="center">
|
|
265
|
+
<a
|
|
266
|
+
href="https://twicsy.com/buy-instagram-followers/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
|
|
267
|
+
target="_blank"
|
|
268
|
+
><b>twicsy.com</b></a
|
|
269
|
+
>
|
|
270
|
+
</p>
|
|
270
271
|
</td>
|
|
271
272
|
<td align="center" width="33.333333333333336%">
|
|
272
273
|
<a
|
|
273
|
-
href="https://
|
|
274
|
+
href="https://global.fun88.com/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
|
|
275
|
+
style="padding: 10px; display: inline-block"
|
|
274
276
|
target="_blank"
|
|
275
|
-
>💜 Become a sponsor</a
|
|
276
277
|
>
|
|
278
|
+
<img
|
|
279
|
+
width="71px"
|
|
280
|
+
height="70px"
|
|
281
|
+
src="https://images.opencollective.com/fun88-official/bf2843c/logo.png"
|
|
282
|
+
alt="Fun 88"
|
|
283
|
+
/>
|
|
284
|
+
</a>
|
|
285
|
+
<p
|
|
286
|
+
align="center"
|
|
287
|
+
>
|
|
288
|
+
Fun88 is a global online gambling and betting brand founded in 2009, offering a wide range of services including sports betting, live casino games, slots, and virtual gaming.
|
|
289
|
+
</p>
|
|
290
|
+
<p align="center">
|
|
291
|
+
<a
|
|
292
|
+
href="https://global.fun88.com/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
|
|
293
|
+
target="_blank"
|
|
294
|
+
><b>global.fun88.com</b></a
|
|
295
|
+
>
|
|
296
|
+
</p>
|
|
277
297
|
</td>
|
|
278
298
|
</tr>
|
|
279
299
|
</table>
|
|
280
300
|
|
|
281
|
-
|
|
282
301
|
<!--<div>marker</div>-->
|
|
283
302
|
|
|
284
303
|
<br><br>
|
|
@@ -297,62 +316,61 @@
|
|
|
297
316
|
<div align="center">
|
|
298
317
|
|
|
299
318
|
[](https://www.npmjs.org/package/axios)
|
|
300
|
-
[](https://cdnjs.com/libraries/axios)
|
|
301
319
|
[](https://github.com/axios/axios/actions/workflows/ci.yml)
|
|
302
320
|
[](https://gitpod.io/#https://github.com/axios/axios)
|
|
303
|
-
[](https://coveralls.io/r/mzabriskie/axios)
|
|
304
321
|
[](https://packagephobia.now.sh/result?p=axios)
|
|
305
322
|
[](https://bundlephobia.com/package/axios@latest)
|
|
306
323
|
[](https://npm-stat.com/charts.html?package=axios)
|
|
307
324
|
[](https://gitter.im/mzabriskie/axios)
|
|
308
325
|
[](https://www.codetriage.com/axios/axios)
|
|
309
326
|
[](CONTRIBUTORS.md)
|
|
327
|
+
[](https://agentfriendlycode.com/repo/32)
|
|
310
328
|
|
|
311
329
|
</div>
|
|
312
330
|
|
|
313
|
-
## Table of
|
|
331
|
+
## Table of contents
|
|
314
332
|
|
|
315
333
|
- [Features](#features)
|
|
316
|
-
- [Browser
|
|
334
|
+
- [Browser support](#browser-support)
|
|
317
335
|
- [Installing](#installing)
|
|
318
336
|
- [Package manager](#package-manager)
|
|
319
337
|
- [CDN](#cdn)
|
|
320
338
|
- [Example](#example)
|
|
321
339
|
- [Axios API](#axios-api)
|
|
322
340
|
- [Request method aliases](#request-method-aliases)
|
|
323
|
-
- [Concurrency
|
|
341
|
+
- [Concurrency](#concurrency-deprecated)
|
|
324
342
|
- [Creating an instance](#creating-an-instance)
|
|
325
343
|
- [Instance methods](#instance-methods)
|
|
326
|
-
- [Request
|
|
327
|
-
- [Response
|
|
328
|
-
- [Config
|
|
344
|
+
- [Request config](#request-config)
|
|
345
|
+
- [Response schema](#response-schema)
|
|
346
|
+
- [Config defaults](#config-defaults)
|
|
329
347
|
- [Global axios defaults](#global-axios-defaults)
|
|
330
348
|
- [Custom instance defaults](#custom-instance-defaults)
|
|
331
349
|
- [Config order of precedence](#config-order-of-precedence)
|
|
332
350
|
- [Interceptors](#interceptors)
|
|
333
|
-
- [Multiple
|
|
334
|
-
- [Handling
|
|
335
|
-
- [Handling
|
|
351
|
+
- [Multiple interceptors](#multiple-interceptors)
|
|
352
|
+
- [Handling errors](#handling-errors)
|
|
353
|
+
- [Handling timeouts](#handling-timeouts)
|
|
336
354
|
- [Cancellation](#cancellation)
|
|
337
355
|
- [AbortController](#abortcontroller)
|
|
338
|
-
- [CancelToken
|
|
356
|
+
- [CancelToken](#canceltoken-deprecated)
|
|
339
357
|
- [Using application/x-www-form-urlencoded format](#using-applicationx-www-form-urlencoded-format)
|
|
340
358
|
- [URLSearchParams](#urlsearchparams)
|
|
341
359
|
- [Query string](#query-string-older-browsers)
|
|
342
|
-
- [
|
|
360
|
+
- [Automatic serialization](#automatic-serialization-to-urlsearchparams)
|
|
343
361
|
- [Using multipart/form-data format](#using-multipartform-data-format)
|
|
344
362
|
- [FormData](#formdata)
|
|
345
|
-
- [
|
|
346
|
-
- [
|
|
347
|
-
- [HTML
|
|
348
|
-
- [
|
|
349
|
-
- [
|
|
350
|
-
- [
|
|
351
|
-
- [
|
|
352
|
-
- [
|
|
353
|
-
- [
|
|
354
|
-
- [
|
|
355
|
-
- [
|
|
363
|
+
- [Automatic serialization](#automatic-serialization-to-formdata)
|
|
364
|
+
- [Posting files](#posting-files)
|
|
365
|
+
- [HTML form posting](#html-form-posting-browser)
|
|
366
|
+
- [Progress capturing](#progress-capturing)
|
|
367
|
+
- [Rate limiting](#rate-limiting)
|
|
368
|
+
- [AxiosHeaders](#axiosheaders)
|
|
369
|
+
- [Fetch adapter](#fetch-adapter)
|
|
370
|
+
- [Custom fetch](#custom-fetch)
|
|
371
|
+
- [Using with Tauri](#using-with-tauri)
|
|
372
|
+
- [Using with SvelteKit](#using-with-sveltekit)
|
|
373
|
+
- [HTTP/2 support](#http2-support)
|
|
356
374
|
- [Semver](#semver)
|
|
357
375
|
- [Promises](#promises)
|
|
358
376
|
- [TypeScript](#typescript)
|
|
@@ -364,17 +382,17 @@
|
|
|
364
382
|
|
|
365
383
|
## Features
|
|
366
384
|
|
|
367
|
-
-
|
|
368
|
-
-
|
|
369
|
-
-
|
|
370
|
-
-
|
|
371
|
-
-
|
|
372
|
-
-
|
|
373
|
-
-
|
|
374
|
-
-
|
|
375
|
-
-
|
|
385
|
+
- Make [XMLHttpRequests](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) from the browser.
|
|
386
|
+
- Make [http](https://nodejs.org/api/http.html) requests from Node.js.
|
|
387
|
+
- Use the [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) API for asynchronous request handling.
|
|
388
|
+
- Intercept requests and responses to add custom logic or transform data.
|
|
389
|
+
- Transform request and response data.
|
|
390
|
+
- Cancel requests with built-in cancellation APIs.
|
|
391
|
+
- Serialize and parse [JSON](https://www.json.org/json-en.html) data.
|
|
392
|
+
- Serialize data objects to `multipart/form-data` or `application/x-www-form-urlencoded`.
|
|
393
|
+
- Add client-side protection against [Cross-Site Request Forgery](https://en.wikipedia.org/wiki/Cross-site_request_forgery).
|
|
376
394
|
|
|
377
|
-
## Browser
|
|
395
|
+
## Browser support
|
|
378
396
|
|
|
379
397
|
| Chrome | Firefox | Safari | Opera | Edge |
|
|
380
398
|
| :------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------: |
|
|
@@ -411,7 +429,13 @@ Using bun:
|
|
|
411
429
|
$ bun add axios
|
|
412
430
|
```
|
|
413
431
|
|
|
414
|
-
|
|
432
|
+
Using Deno:
|
|
433
|
+
|
|
434
|
+
```bash
|
|
435
|
+
$ deno add axios
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
Once the package is installed, import it with `import` or `require`:
|
|
415
439
|
|
|
416
440
|
```js
|
|
417
441
|
import axios, { isCancel, AxiosError } from 'axios';
|
|
@@ -433,14 +457,13 @@ const axios = require('axios');
|
|
|
433
457
|
console.log(axios.isCancel('something'));
|
|
434
458
|
```
|
|
435
459
|
|
|
436
|
-
|
|
460
|
+
Some bundlers and ES6 linters need this form:
|
|
437
461
|
|
|
438
462
|
```js
|
|
439
463
|
import { default as axios } from 'axios';
|
|
440
464
|
```
|
|
441
465
|
|
|
442
|
-
|
|
443
|
-
you can try importing the module package directly:
|
|
466
|
+
In custom or legacy environments, you can import the bundle directly:
|
|
444
467
|
|
|
445
468
|
```js
|
|
446
469
|
const axios = require('axios/dist/browser/axios.cjs'); // browser commonJS bundle (ES2017)
|
|
@@ -480,7 +503,7 @@ axios
|
|
|
480
503
|
params: {
|
|
481
504
|
ID: 12345,
|
|
482
505
|
},
|
|
483
|
-
timeout: 5000, // 5 seconds
|
|
506
|
+
timeout: 5000, // 5 seconds. See "Handling Timeouts" below for matching error handling
|
|
484
507
|
})
|
|
485
508
|
.then(function (response) {
|
|
486
509
|
console.log(response);
|
|
@@ -495,7 +518,15 @@ axios
|
|
|
495
518
|
// Want to use async/await? Add the `async` keyword to your outer function/method.
|
|
496
519
|
async function getUser() {
|
|
497
520
|
try {
|
|
498
|
-
|
|
521
|
+
// Example: GET request with query parameters
|
|
522
|
+
const response = await axios.get('/user', {
|
|
523
|
+
params: {
|
|
524
|
+
ID: 12345,
|
|
525
|
+
},
|
|
526
|
+
});
|
|
527
|
+
|
|
528
|
+
// Using the `params` option improves readability and automatically formats query strings
|
|
529
|
+
|
|
499
530
|
console.log(response);
|
|
500
531
|
} catch (error) {
|
|
501
532
|
console.error(error);
|
|
@@ -503,10 +534,10 @@ async function getUser() {
|
|
|
503
534
|
}
|
|
504
535
|
```
|
|
505
536
|
|
|
506
|
-
>
|
|
537
|
+
> Note: Set a `timeout` in production. Without one, a stalled request can hang
|
|
507
538
|
> indefinitely. See [Handling Timeouts](#handling-timeouts) for the matching error handling.
|
|
508
539
|
|
|
509
|
-
>
|
|
540
|
+
> Note: `async/await` is part of ECMAScript 2017 and is not supported in Internet
|
|
510
541
|
> Explorer and older browsers, so use with caution.
|
|
511
542
|
|
|
512
543
|
Performing a `POST` request
|
|
@@ -591,13 +622,13 @@ For convenience, aliases have been provided for all common request methods.
|
|
|
591
622
|
|
|
592
623
|
##### axios.patch(url[, data[, config]])
|
|
593
624
|
|
|
594
|
-
######
|
|
625
|
+
###### Note
|
|
595
626
|
|
|
596
627
|
When using the alias methods `url`, `method`, and `data` properties don't need to be specified in config.
|
|
597
628
|
|
|
598
|
-
### Concurrency (
|
|
629
|
+
### Concurrency (deprecated)
|
|
599
630
|
|
|
600
|
-
|
|
631
|
+
Use `Promise.all` instead of these helpers.
|
|
601
632
|
|
|
602
633
|
Helper functions for dealing with concurrent requests.
|
|
603
634
|
|
|
@@ -620,7 +651,7 @@ const instance = axios.create({
|
|
|
620
651
|
|
|
621
652
|
### Instance methods
|
|
622
653
|
|
|
623
|
-
The
|
|
654
|
+
The following instance methods are available. Axios merges the specified config with the instance config.
|
|
624
655
|
|
|
625
656
|
##### axios#request(config)
|
|
626
657
|
|
|
@@ -640,11 +671,11 @@ The available instance methods are listed below. The specified config will be me
|
|
|
640
671
|
|
|
641
672
|
##### axios#getUri([config])
|
|
642
673
|
|
|
643
|
-
## Request
|
|
674
|
+
## Request config
|
|
644
675
|
|
|
645
|
-
###
|
|
676
|
+
### Security notice: decompression-bomb protection is opt-in
|
|
646
677
|
|
|
647
|
-
By default `maxContentLength` and `maxBodyLength` are `-1` (unlimited). A malicious or compromised server can return a tiny gzip/deflate/brotli body that expands to gigabytes and exhaust the Node.js process.
|
|
678
|
+
By default `maxContentLength` and `maxBodyLength` are `-1` (unlimited). A malicious or compromised server can return a tiny gzip/deflate/brotli/zstd body that expands to gigabytes and exhaust the Node.js process.
|
|
648
679
|
|
|
649
680
|
If you call servers you do not fully trust, **set a cap**:
|
|
650
681
|
|
|
@@ -655,17 +686,17 @@ axios.defaults.maxBodyLength = 10 * 1024 * 1024;
|
|
|
655
686
|
|
|
656
687
|
See the [security guide](https://axios.rest/pages/misc/security.html) for details.
|
|
657
688
|
|
|
658
|
-
These are
|
|
689
|
+
These config options are available for requests. Only `url` is required. Requests default to `GET` when `method` is not set.
|
|
659
690
|
|
|
660
691
|
```js
|
|
661
692
|
{
|
|
662
|
-
// `url` is the server URL
|
|
693
|
+
// `url` is the server URL for the request
|
|
663
694
|
url: '/user',
|
|
664
695
|
|
|
665
696
|
// `method` is the request method to be used when making the request
|
|
666
697
|
method: 'get', // default
|
|
667
698
|
|
|
668
|
-
// `baseURL`
|
|
699
|
+
// Axios prepends `baseURL` to `url` unless `url` is absolute and `allowAbsoluteUrls` is set to true.
|
|
669
700
|
// It can be convenient to set `baseURL` for an instance of axios to pass relative URLs
|
|
670
701
|
// to the methods of that instance.
|
|
671
702
|
baseURL: 'https://some-domain.com/api/',
|
|
@@ -694,7 +725,7 @@ These are the available config options for making requests. Only the `url` is re
|
|
|
694
725
|
return data;
|
|
695
726
|
}],
|
|
696
727
|
|
|
697
|
-
// `parseReviver` is an optional function
|
|
728
|
+
// `parseReviver` is an optional function passed as the
|
|
698
729
|
// second argument (reviver) to JSON.parse()
|
|
699
730
|
parseReviver: function (key, value, context) {
|
|
700
731
|
// In modern environments, context.source provides the raw JSON string
|
|
@@ -744,9 +775,12 @@ These are the available config options for making requests. Only the `url` is re
|
|
|
744
775
|
|
|
745
776
|
// `data` is the data to be sent as the request body
|
|
746
777
|
// Only applicable for request methods 'PUT', 'POST', 'DELETE', and 'PATCH'
|
|
778
|
+
// `data` is request-specific: axios does not inherit or deep-merge it from defaults.
|
|
779
|
+
// To add shared body fields, use a request interceptor or transformRequest.
|
|
747
780
|
// When no `transformRequest` is set, it must be of one of the following types:
|
|
748
781
|
// - string, plain object, ArrayBuffer, ArrayBufferView, URLSearchParams
|
|
749
782
|
// - Browser only: FormData, File, Blob
|
|
783
|
+
// - React Native: FormData
|
|
750
784
|
// - Node only: Stream, Buffer, FormData (form-data package)
|
|
751
785
|
data: {
|
|
752
786
|
firstName: 'Fred'
|
|
@@ -763,7 +797,7 @@ These are the available config options for making requests. Only the `url` is re
|
|
|
763
797
|
data: 'Country=Brasil&City=Belo Horizonte',
|
|
764
798
|
|
|
765
799
|
// `timeout` specifies the number of milliseconds before the request times out.
|
|
766
|
-
// If the request takes longer than `timeout`,
|
|
800
|
+
// If the request takes longer than `timeout`, Axios aborts it.
|
|
767
801
|
timeout: 1000, // default is `0` (no timeout)
|
|
768
802
|
|
|
769
803
|
// `withCredentials` indicates whether or not cross-site Access-Control requests
|
|
@@ -784,6 +818,12 @@ These are the available config options for making requests. Only the `url` is re
|
|
|
784
818
|
// `auth` indicates that HTTP Basic auth should be used, and supplies credentials.
|
|
785
819
|
// This will set an `Authorization` header, overwriting any existing
|
|
786
820
|
// `Authorization` custom headers you have set using `headers`.
|
|
821
|
+
// If `auth` is omitted, the Node.js HTTP and fetch adapters can read
|
|
822
|
+
// HTTP Basic auth credentials from the request URL, for example
|
|
823
|
+
// `https://user:pass@example.com`. Axios decodes percent-encoded URL
|
|
824
|
+
// credentials, and `auth` takes precedence over URL-embedded credentials.
|
|
825
|
+
// The Node.js HTTP adapter preserves Basic auth on same-origin redirects
|
|
826
|
+
// and strips it on cross-origin redirects.
|
|
787
827
|
// Please note that only HTTP Basic auth is configurable through this parameter.
|
|
788
828
|
// For Bearer tokens and such, use `Authorization` custom headers instead.
|
|
789
829
|
auth: {
|
|
@@ -845,10 +885,12 @@ These are the available config options for making requests. Only the `url` is re
|
|
|
845
885
|
// Do whatever you want with the Axios progress event
|
|
846
886
|
},
|
|
847
887
|
|
|
848
|
-
// `maxContentLength` defines the max size of the
|
|
888
|
+
// `maxContentLength` defines the max size of the response content in bytes.
|
|
889
|
+
// It is enforced by the Node.js HTTP adapter and the fetch adapter.
|
|
849
890
|
maxContentLength: 2000,
|
|
850
891
|
|
|
851
|
-
// `maxBodyLength`
|
|
892
|
+
// `maxBodyLength` defines the max size of the request content in bytes.
|
|
893
|
+
// It is enforced by the Node.js HTTP adapter and the fetch adapter when the body length can be determined.
|
|
852
894
|
maxBodyLength: 2000,
|
|
853
895
|
|
|
854
896
|
// `redact` masks matching config keys when AxiosError#toJSON() is called.
|
|
@@ -856,18 +898,26 @@ These are the available config options for making requests. Only the `url` is re
|
|
|
856
898
|
redact: ['authorization', 'password'],
|
|
857
899
|
|
|
858
900
|
// `validateStatus` defines whether to resolve or reject the promise for a given
|
|
859
|
-
// HTTP response status code. If `validateStatus` returns `true`
|
|
860
|
-
//
|
|
861
|
-
//
|
|
901
|
+
// HTTP response status code. If `validateStatus` returns `true` or is set to
|
|
902
|
+
// `null`, Axios resolves the promise; otherwise, Axios rejects it.
|
|
903
|
+
// Explicit `validateStatus: undefined` resolves every status by default for
|
|
904
|
+
// backward compatibility. Set `transitional.validateStatusUndefinedResolves`
|
|
905
|
+
// to `false` to make explicit `undefined` behave as if this option was omitted.
|
|
862
906
|
validateStatus: function (status) {
|
|
863
907
|
return status >= 200 && status < 300; // default
|
|
864
908
|
},
|
|
865
909
|
|
|
866
910
|
// `maxRedirects` defines the maximum number of redirects to follow in node.js.
|
|
867
|
-
// If set to 0, no redirects
|
|
911
|
+
// If set to 0, Axios follows no redirects.
|
|
868
912
|
maxRedirects: 21, // default
|
|
869
913
|
|
|
870
|
-
// `
|
|
914
|
+
// `sensitiveHeaders` (Node only option) lists custom secret-bearing headers
|
|
915
|
+
// (such as `X-API-Key`) to remove from cross-origin redirects. Matching is
|
|
916
|
+
// case-insensitive. Same-origin redirects keep these headers. If
|
|
917
|
+
// `maxRedirects` is 0, this option is not used.
|
|
918
|
+
sensitiveHeaders: ['X-API-Key'],
|
|
919
|
+
|
|
920
|
+
// `beforeRedirect` defines a function that Axios calls before redirect.
|
|
871
921
|
// Use this to adjust the request options upon redirecting,
|
|
872
922
|
// to inspect the latest response headers,
|
|
873
923
|
// or to cancel the request by throwing an error
|
|
@@ -883,16 +933,10 @@ These are the available config options for making requests. Only the `url` is re
|
|
|
883
933
|
},
|
|
884
934
|
// Security note:
|
|
885
935
|
// The `beforeRedirect` hook runs after sensitive headers are stripped during redirects.
|
|
886
|
-
//
|
|
887
|
-
//
|
|
888
|
-
//
|
|
889
|
-
|
|
890
|
-
// Security note:
|
|
891
|
-
// The beforeRedirect hook runs after sensitive headers are stripped during redirects.
|
|
892
|
-
// Re-injecting credentials without checking the destination can expose sensitive data.
|
|
893
|
-
// Only add credentials for trusted HTTPS destinations.
|
|
894
|
-
// Avoid re-adding credentials on downgraded redirects.
|
|
895
|
-
|
|
936
|
+
// `follow-redirects` removes credentials on protocol downgrades
|
|
937
|
+
// (HTTPS to HTTP). Because `beforeRedirect` runs after that step,
|
|
938
|
+
// re-injecting credentials without checking the destination can expose
|
|
939
|
+
// sensitive data. Only add credentials for trusted HTTPS destinations.
|
|
896
940
|
|
|
897
941
|
// `socketPath` defines a UNIX Socket to be used in node.js.
|
|
898
942
|
// e.g. '/var/run/docker.sock' to send requests to the docker daemon.
|
|
@@ -911,10 +955,10 @@ These are the available config options for making requests. Only the `url` is re
|
|
|
911
955
|
// `ERR_BAD_OPTION_VALUE`. When null/undefined, no restriction is applied.
|
|
912
956
|
allowedSocketPaths: null, // default
|
|
913
957
|
|
|
914
|
-
// `transport` determines the transport method
|
|
915
|
-
// If defined,
|
|
916
|
-
// the default `http` or `https` library
|
|
917
|
-
// Otherwise, the `httpFollow` or `httpsFollow` library
|
|
958
|
+
// `transport` determines the transport method for the request.
|
|
959
|
+
// If defined, Axios uses it. Otherwise, if `maxRedirects` is 0,
|
|
960
|
+
// Axios uses the default `http` or `https` library, depending on the protocol specified in `protocol`.
|
|
961
|
+
// Otherwise, Axios uses the `httpFollow` or `httpsFollow` library, again depending on the protocol,
|
|
918
962
|
// which can handle redirects.
|
|
919
963
|
transport: undefined, // default
|
|
920
964
|
|
|
@@ -932,17 +976,35 @@ These are the available config options for making requests. Only the `url` is re
|
|
|
932
976
|
// for your proxy configuration, you can also define a `no_proxy` environment
|
|
933
977
|
// variable as a comma-separated list of domains that should not be proxied.
|
|
934
978
|
// Use `false` to disable proxies, ignoring environment variables.
|
|
979
|
+
// On Node.js versions with native environment proxy support, axios defers
|
|
980
|
+
// environment proxy handling to Node when the selected agent has `proxyEnv`
|
|
981
|
+
// enabled, including processes started with `NODE_USE_ENV_PROXY=1`,
|
|
982
|
+
// `--use-env-proxy`, or `NODE_OPTIONS=--use-env-proxy`. Custom agents without
|
|
983
|
+
// `proxyEnv` continue to use axios environment proxy resolution. Explicit
|
|
984
|
+
// `proxy` config is still handled by axios.
|
|
935
985
|
// `auth` indicates that HTTP Basic auth should be used to connect to the proxy, and
|
|
936
986
|
// supplies credentials.
|
|
937
|
-
//
|
|
938
|
-
// `Proxy-Authorization`
|
|
987
|
+
// For `http://` targets, axios sends the request to the proxy in
|
|
988
|
+
// forward-proxy mode and stamps `Proxy-Authorization` onto the request
|
|
989
|
+
// headers (overwriting any user-supplied `Proxy-Authorization` header).
|
|
990
|
+
// For `https://` targets, axios establishes a CONNECT tunnel through the
|
|
991
|
+
// proxy and performs TLS end-to-end with the origin; `Proxy-Authorization`
|
|
992
|
+
// is sent on the CONNECT request only, never on the wrapped TLS request,
|
|
993
|
+
// so the proxy never sees the URL, headers, or body. Axios forwards
|
|
994
|
+
// `httpsAgent` TLS options such as `ca`, `cert`, `key`, and
|
|
995
|
+
// `rejectUnauthorized` to the generated tunneling agent, so they still apply
|
|
996
|
+
// to the origin TLS connection.
|
|
997
|
+
// If you supply an `HttpsProxyAgent`, axios leaves tunneling to that agent.
|
|
939
998
|
// If the proxy server uses HTTPS, then you must set the protocol to `https`.
|
|
940
999
|
// A user-supplied `Host` header in `headers` is preserved when forwarding
|
|
941
1000
|
// through a proxy (case-insensitive match on `host`/`Host`/`HOST`); this
|
|
942
|
-
// lets you target a virtual host that differs from the request URL
|
|
1001
|
+
// lets you target a virtual host that differs from the request URL, for
|
|
943
1002
|
// example, hitting `127.0.0.1:4000` while having the proxy treat the
|
|
944
1003
|
// request as `example.com`. If no `Host` header is supplied, axios
|
|
945
|
-
// defaults it to the request URL's `hostname:port` as before.
|
|
1004
|
+
// defaults it to the request URL's `hostname:port` as before. The Host
|
|
1005
|
+
// header is only set in forward-proxy mode (HTTP targets); for HTTPS
|
|
1006
|
+
// tunneling the Host header is sent inside the TLS connection, not seen
|
|
1007
|
+
// by the proxy.
|
|
946
1008
|
proxy: {
|
|
947
1009
|
protocol: 'https',
|
|
948
1010
|
host: '127.0.0.1',
|
|
@@ -965,6 +1027,8 @@ These are the available config options for making requests. Only the `url` is re
|
|
|
965
1027
|
// `decompress` indicates whether or not the response body should be decompressed
|
|
966
1028
|
// automatically. If set to `true` will also remove the 'content-encoding' header
|
|
967
1029
|
// from the responses objects of all decompressed responses
|
|
1030
|
+
// Axios supports gzip, deflate, brotli, and zstd when the current Node.js
|
|
1031
|
+
// runtime provides the corresponding zlib decompressor.
|
|
968
1032
|
// - Node only (XHR cannot turn off decompression)
|
|
969
1033
|
decompress: true, // default
|
|
970
1034
|
|
|
@@ -994,6 +1058,16 @@ These are the available config options for making requests. Only the `url` is re
|
|
|
994
1058
|
// throw ETIMEDOUT error instead of generic ECONNABORTED on request timeouts
|
|
995
1059
|
clarifyTimeoutError: false,
|
|
996
1060
|
|
|
1061
|
+
// keep explicit `validateStatus: undefined` resolving every response status
|
|
1062
|
+
// for backward compatibility. Set to false to make explicit undefined behave
|
|
1063
|
+
// as if validateStatus was omitted.
|
|
1064
|
+
validateStatusUndefinedResolves: true,
|
|
1065
|
+
|
|
1066
|
+
// advertise `zstd` in the default Accept-Encoding header when the current
|
|
1067
|
+
// Node.js runtime supports zstd decompression. Axios still decompresses
|
|
1068
|
+
// zstd responses when support exists and `decompress` is true.
|
|
1069
|
+
advertiseZstdAcceptEncoding: false,
|
|
1070
|
+
|
|
997
1071
|
// use the legacy interceptor request/response ordering
|
|
998
1072
|
legacyInterceptorReqResOrdering: true, // default
|
|
999
1073
|
},
|
|
@@ -1019,6 +1093,15 @@ These are the available config options for making requests. Only the `url` is re
|
|
|
1019
1093
|
}
|
|
1020
1094
|
```
|
|
1021
1095
|
|
|
1096
|
+
For custom secret-bearing headers in Node.js, list them in `sensitiveHeaders` so Axios removes them when following a redirect to another origin:
|
|
1097
|
+
|
|
1098
|
+
```js
|
|
1099
|
+
axios.get('https://api.example.com/users', {
|
|
1100
|
+
headers: { 'X-API-Key': 'secret' },
|
|
1101
|
+
sensitiveHeaders: ['X-API-Key'],
|
|
1102
|
+
});
|
|
1103
|
+
```
|
|
1104
|
+
|
|
1022
1105
|
### Strict RFC 3986 percent-encoding for query params
|
|
1023
1106
|
|
|
1024
1107
|
By default, axios decodes `%3A`, `%24`, `%2C` and `%20` back to `:`, `$`, `,` and `+` for readability (the `+` follows the `application/x-www-form-urlencoded` convention for spaces in query strings). These characters are valid in a query component under [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986#section-3.4), so the default output is correct, but some backends require strict percent-encoding and reject the readable form.
|
|
@@ -1029,26 +1112,26 @@ Override the default encoder via `paramsSerializer.encode`:
|
|
|
1029
1112
|
// Per-request: emit strict RFC 3986 percent-encoding for query values
|
|
1030
1113
|
axios.get('/foo', {
|
|
1031
1114
|
params: { filter: JSON.stringify({ startedAt: '2026-01-23' }) },
|
|
1032
|
-
paramsSerializer: { encode: encodeURIComponent }
|
|
1115
|
+
paramsSerializer: { encode: encodeURIComponent },
|
|
1033
1116
|
});
|
|
1034
1117
|
|
|
1035
1118
|
// Or set it on the instance defaults
|
|
1036
1119
|
const client = axios.create({
|
|
1037
|
-
paramsSerializer: { encode: encodeURIComponent }
|
|
1120
|
+
paramsSerializer: { encode: encodeURIComponent },
|
|
1038
1121
|
});
|
|
1039
1122
|
```
|
|
1040
1123
|
|
|
1041
|
-
##
|
|
1124
|
+
## HTTP/2 support
|
|
1042
1125
|
|
|
1043
|
-
Axios has experimental HTTP/2 support
|
|
1126
|
+
Axios has experimental HTTP/2 support in the Node.js HTTP adapter.
|
|
1044
1127
|
|
|
1045
|
-
Support depends on the runtime environment and Node.js version.
|
|
1128
|
+
Support depends on the runtime environment and Node.js version. Redirects and some adapter behavior may differ from HTTP/1.1.
|
|
1046
1129
|
|
|
1047
|
-
Options like `httpVersion` and `http2Options` are adapter-specific and may not work
|
|
1130
|
+
Options like `httpVersion` and `http2Options` are adapter-specific and may not work the same way in every environment.
|
|
1048
1131
|
|
|
1049
|
-
If HTTP/2
|
|
1132
|
+
If you need HTTP/2, check runtime support or use a custom adapter.
|
|
1050
1133
|
|
|
1051
|
-
## Response
|
|
1134
|
+
## Response schema
|
|
1052
1135
|
|
|
1053
1136
|
The response to a request contains the following information.
|
|
1054
1137
|
|
|
@@ -1078,7 +1161,7 @@ The response to a request contains the following information.
|
|
|
1078
1161
|
}
|
|
1079
1162
|
```
|
|
1080
1163
|
|
|
1081
|
-
When using `then`, you
|
|
1164
|
+
When using `then`, you receive the response like this:
|
|
1082
1165
|
|
|
1083
1166
|
```js
|
|
1084
1167
|
const response = await axios.get('/user/12345');
|
|
@@ -1089,18 +1172,18 @@ console.log(response.headers);
|
|
|
1089
1172
|
console.log(response.config);
|
|
1090
1173
|
```
|
|
1091
1174
|
|
|
1092
|
-
When using `catch`, or passing a [rejection callback](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then) as second parameter of `then`, the response
|
|
1175
|
+
When using `catch`, or passing a [rejection callback](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then) as the second parameter of `then`, read the response from the `error` object. See [Handling errors](#handling-errors).
|
|
1093
1176
|
|
|
1094
|
-
## Config
|
|
1177
|
+
## Config defaults
|
|
1095
1178
|
|
|
1096
|
-
|
|
1179
|
+
Config defaults apply to every request.
|
|
1097
1180
|
|
|
1098
1181
|
### Global axios defaults
|
|
1099
1182
|
|
|
1100
1183
|
```js
|
|
1101
1184
|
axios.defaults.baseURL = 'https://api.example.com';
|
|
1102
1185
|
|
|
1103
|
-
// Important: If
|
|
1186
|
+
// Important: If you use axios with multiple domains, Axios sends AUTH_TOKEN to all of them.
|
|
1104
1187
|
// See below for an example using Custom instance defaults instead.
|
|
1105
1188
|
axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
|
|
1106
1189
|
|
|
@@ -1121,7 +1204,9 @@ instance.defaults.headers.common['Authorization'] = AUTH_TOKEN;
|
|
|
1121
1204
|
|
|
1122
1205
|
### Config order of precedence
|
|
1123
1206
|
|
|
1124
|
-
|
|
1207
|
+
Axios merges config in this order: library defaults from [lib/defaults/index.js](https://github.com/axios/axios/blob/main/lib/defaults/index.js#L49), the instance `defaults` property, and the request `config` argument. Later values take precedence over earlier ones.
|
|
1208
|
+
|
|
1209
|
+
Some options are request-specific and are only taken from the request `config`. `data` is one of those options: axios does not inherit or deep-merge request bodies from global or instance defaults. If every request needs shared body fields, add them with a request interceptor or `transformRequest`, and scope that logic carefully so sensitive values are not sent to the wrong endpoint.
|
|
1125
1210
|
|
|
1126
1211
|
```js
|
|
1127
1212
|
// Create an instance using the config defaults provided by the library
|
|
@@ -1180,7 +1265,7 @@ const instance = axios.create();
|
|
|
1180
1265
|
const myInterceptor = instance.interceptors.request.use(function () {
|
|
1181
1266
|
/*...*/
|
|
1182
1267
|
});
|
|
1183
|
-
|
|
1268
|
+
instance.interceptors.request.eject(myInterceptor);
|
|
1184
1269
|
```
|
|
1185
1270
|
|
|
1186
1271
|
You can also clear all interceptors for requests or responses.
|
|
@@ -1223,8 +1308,8 @@ axios.interceptors.request.use(
|
|
|
1223
1308
|
```
|
|
1224
1309
|
|
|
1225
1310
|
If you want to execute a particular interceptor based on a runtime check,
|
|
1226
|
-
you can add a `runWhen` function to the options object. The request interceptor will not
|
|
1227
|
-
of `runWhen` is `false`.
|
|
1311
|
+
you can add a `runWhen` function to the options object. The request interceptor will not run **if and only if** the return
|
|
1312
|
+
of `runWhen` is `false`. Axios calls the function with the config
|
|
1228
1313
|
object (don't forget that you can bind your own arguments to it as well.) This can be handy when you have an
|
|
1229
1314
|
asynchronous request interceptor that only needs to run at certain times.
|
|
1230
1315
|
|
|
@@ -1242,15 +1327,15 @@ axios.interceptors.request.use(
|
|
|
1242
1327
|
);
|
|
1243
1328
|
```
|
|
1244
1329
|
|
|
1245
|
-
>
|
|
1330
|
+
> Note: The options parameter (with `synchronous` and `runWhen` properties) is only supported for request interceptors at the moment.
|
|
1246
1331
|
|
|
1247
|
-
### Interceptor
|
|
1332
|
+
### Interceptor execution order
|
|
1248
1333
|
|
|
1249
|
-
|
|
1334
|
+
Request and response interceptors use different execution orders.
|
|
1250
1335
|
|
|
1251
|
-
Request interceptors
|
|
1336
|
+
Request interceptors run in reverse order (LIFO: last in, first out). The last interceptor added runs first.
|
|
1252
1337
|
|
|
1253
|
-
Response interceptors
|
|
1338
|
+
Response interceptors run in the order they were added (FIFO: first in, first out). The first interceptor added runs first.
|
|
1254
1339
|
|
|
1255
1340
|
Example:
|
|
1256
1341
|
|
|
@@ -1279,37 +1364,33 @@ instance.interceptors.response.use(interceptor('Response Interceptor 3'));
|
|
|
1279
1364
|
// Response Interceptor 3
|
|
1280
1365
|
```
|
|
1281
1366
|
|
|
1282
|
-
### Multiple
|
|
1367
|
+
### Multiple interceptors
|
|
1283
1368
|
|
|
1284
|
-
|
|
1285
|
-
and when the response was fulfilled
|
|
1369
|
+
When a response is fulfilled and multiple response interceptors are registered:
|
|
1286
1370
|
|
|
1287
|
-
-
|
|
1288
|
-
-
|
|
1289
|
-
-
|
|
1290
|
-
-
|
|
1291
|
-
-
|
|
1292
|
-
- then the following fulfillment-interceptor is not called
|
|
1293
|
-
- then the following rejection-interceptor is called
|
|
1294
|
-
- once caught, another following fulfill-interceptor is called again (just like in a promise chain).
|
|
1371
|
+
- Each interceptor runs in registration order.
|
|
1372
|
+
- Each interceptor receives the result from the previous interceptor.
|
|
1373
|
+
- The chain returns the result from the last interceptor.
|
|
1374
|
+
- If a fulfillment interceptor throws, Axios skips the next fulfillment interceptor and calls the next rejection interceptor.
|
|
1375
|
+
- After the error is caught, later fulfillment interceptors run again, just like in a promise chain.
|
|
1295
1376
|
|
|
1296
1377
|
Read [the interceptor tests](./test/specs/interceptors.spec.js) to see all this in code.
|
|
1297
1378
|
|
|
1298
|
-
## Error
|
|
1379
|
+
## Error types
|
|
1299
1380
|
|
|
1300
|
-
|
|
1381
|
+
Axios error messages include details that can help you debug the request.
|
|
1301
1382
|
|
|
1302
|
-
|
|
1383
|
+
Axios errors use this structure:
|
|
1303
1384
|
| Property | Definition |
|
|
1304
1385
|
| -------- | ---------- |
|
|
1305
1386
|
| message | A quick summary of the error message and the status it failed with. |
|
|
1306
1387
|
| name | This defines where the error originated from. For axios, it will always be an 'AxiosError'. |
|
|
1307
|
-
| stack |
|
|
1388
|
+
| stack | Stack trace for the error. |
|
|
1308
1389
|
| config | An axios config object with specific instance configurations defined by the user from when the request was made |
|
|
1309
|
-
| code |
|
|
1390
|
+
| code | Axios error code. The table below lists internal Axios error codes. |
|
|
1310
1391
|
| status | HTTP response status code. See [here](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes) for common HTTP response status code meanings.
|
|
1311
1392
|
|
|
1312
|
-
|
|
1393
|
+
These are the internal Axios error codes:
|
|
1313
1394
|
|
|
1314
1395
|
| Code | Definition |
|
|
1315
1396
|
| ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -1319,16 +1400,16 @@ Below is a list of potential axios identified error:
|
|
|
1319
1400
|
| ERR_DEPRECATED | Deprecated feature or method used in axios. |
|
|
1320
1401
|
| ERR_INVALID_URL | Invalid URL provided for axios request. |
|
|
1321
1402
|
| ECONNABORTED | Typically indicates that the request has been timed out (unless `transitional.clarifyTimeoutError` is set) or aborted by the browser or its plugin. |
|
|
1322
|
-
| ERR_CANCELED |
|
|
1323
|
-
| ETIMEDOUT | Request timed out
|
|
1403
|
+
| ERR_CANCELED | The user explicitly canceled the request with an AbortSignal or CancelToken. |
|
|
1404
|
+
| ETIMEDOUT | Request timed out after exceeding the configured Axios timeout. Set `transitional.clarifyTimeoutError` to `true`; otherwise Axios throws a generic `ECONNABORTED` error. |
|
|
1324
1405
|
| ERR_NETWORK | Network-related issue. In the browser, this error can also be caused by a [CORS](https://developer.mozilla.org/ru/docs/Web/HTTP/Guides/CORS) or [Mixed Content](https://developer.mozilla.org/en-US/docs/Web/Security/Mixed_content) policy violation. The browser does not allow the JS code to clarify the real reason for the error caused by security issues, so please check the console. |
|
|
1325
|
-
| ERR_FR_TOO_MANY_REDIRECTS | Request
|
|
1406
|
+
| ERR_FR_TOO_MANY_REDIRECTS | Request exceeded the configured maximum number of redirects. |
|
|
1326
1407
|
| ERR_BAD_RESPONSE | Response cannot be parsed properly or is in an unexpected format. Usually related to a response with `5xx` status code. |
|
|
1327
1408
|
| ERR_BAD_REQUEST | The request has an unexpected format or is missing required parameters. Usually related to a response with `4xx` status code. |
|
|
1328
1409
|
|
|
1329
|
-
## Handling
|
|
1410
|
+
## Handling errors
|
|
1330
1411
|
|
|
1331
|
-
|
|
1412
|
+
By default, Axios rejects responses with status codes outside the 2xx range.
|
|
1332
1413
|
|
|
1333
1414
|
```js
|
|
1334
1415
|
axios.get('/user/12345').catch(function (error) {
|
|
@@ -1351,7 +1432,7 @@ axios.get('/user/12345').catch(function (error) {
|
|
|
1351
1432
|
});
|
|
1352
1433
|
```
|
|
1353
1434
|
|
|
1354
|
-
|
|
1435
|
+
Use `validateStatus` to override the default condition (`status >= 200 && status < 300`) and choose which HTTP status codes should reject.
|
|
1355
1436
|
|
|
1356
1437
|
```js
|
|
1357
1438
|
axios.get('/user/12345', {
|
|
@@ -1361,7 +1442,20 @@ axios.get('/user/12345', {
|
|
|
1361
1442
|
});
|
|
1362
1443
|
```
|
|
1363
1444
|
|
|
1364
|
-
|
|
1445
|
+
By default, explicit `validateStatus: undefined` keeps legacy behavior and resolves every response status because `transitional.validateStatusUndefinedResolves` defaults to `true`. Set it to `false` to make explicit `validateStatus: undefined` behave like the option was omitted, so Axios uses the configured/default validator and rejects non-2xx responses by default.
|
|
1446
|
+
|
|
1447
|
+
`validateStatus: null` still accepts every response status. If you disable the transitional behavior and intentionally want all statuses to resolve, use `null` or `() => true`.
|
|
1448
|
+
|
|
1449
|
+
```js
|
|
1450
|
+
axios.get('/user/12345', {
|
|
1451
|
+
validateStatus: undefined,
|
|
1452
|
+
transitional: {
|
|
1453
|
+
validateStatusUndefinedResolves: false,
|
|
1454
|
+
},
|
|
1455
|
+
});
|
|
1456
|
+
```
|
|
1457
|
+
|
|
1458
|
+
Use `toJSON` to get more information about the HTTP error.
|
|
1365
1459
|
|
|
1366
1460
|
```js
|
|
1367
1461
|
axios.get('/user/12345').catch(function (error) {
|
|
@@ -1372,15 +1466,17 @@ axios.get('/user/12345').catch(function (error) {
|
|
|
1372
1466
|
To avoid logging secrets from `error.config`, pass a `redact` array in the request config. Matching config keys are masked case-insensitively at any depth when `AxiosError#toJSON()` is called.
|
|
1373
1467
|
|
|
1374
1468
|
```js
|
|
1375
|
-
axios
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1469
|
+
axios
|
|
1470
|
+
.get('/user/12345', {
|
|
1471
|
+
headers: { Authorization: 'Bearer token' },
|
|
1472
|
+
redact: ['authorization'],
|
|
1473
|
+
})
|
|
1474
|
+
.catch(function (error) {
|
|
1475
|
+
console.log(error.toJSON().config.headers.Authorization); // [REDACTED ****]
|
|
1476
|
+
});
|
|
1381
1477
|
```
|
|
1382
1478
|
|
|
1383
|
-
## Handling
|
|
1479
|
+
## Handling timeouts
|
|
1384
1480
|
|
|
1385
1481
|
```js
|
|
1386
1482
|
async function fetchWithTimeout() {
|
|
@@ -1414,7 +1510,7 @@ async function fetchWithTimeout() {
|
|
|
1414
1510
|
|
|
1415
1511
|
### AbortController
|
|
1416
1512
|
|
|
1417
|
-
|
|
1513
|
+
Since `v0.22.0`, Axios supports AbortController:
|
|
1418
1514
|
|
|
1419
1515
|
```js
|
|
1420
1516
|
const controller = new AbortController();
|
|
@@ -1430,15 +1526,15 @@ axios
|
|
|
1430
1526
|
controller.abort();
|
|
1431
1527
|
```
|
|
1432
1528
|
|
|
1433
|
-
### CancelToken
|
|
1529
|
+
### CancelToken (deprecated)
|
|
1434
1530
|
|
|
1435
1531
|
You can also cancel a request using a _CancelToken_.
|
|
1436
1532
|
|
|
1437
1533
|
> The axios cancel token API is based on the withdrawn [cancellable promises proposal](https://github.com/tc39/proposal-cancelable-promises).
|
|
1438
1534
|
|
|
1439
|
-
> This API is deprecated since v0.22.0 and
|
|
1535
|
+
> This API is deprecated since v0.22.0 and should not be used in new projects.
|
|
1440
1536
|
|
|
1441
|
-
|
|
1537
|
+
Create a cancel token with the `CancelToken.source` factory:
|
|
1442
1538
|
|
|
1443
1539
|
```js
|
|
1444
1540
|
const CancelToken = axios.CancelToken;
|
|
@@ -1470,7 +1566,7 @@ axios.post(
|
|
|
1470
1566
|
source.cancel('Operation canceled by the user.');
|
|
1471
1567
|
```
|
|
1472
1568
|
|
|
1473
|
-
You can also
|
|
1569
|
+
You can also pass an executor function to the `CancelToken` constructor:
|
|
1474
1570
|
|
|
1475
1571
|
```js
|
|
1476
1572
|
const CancelToken = axios.CancelToken;
|
|
@@ -1487,16 +1583,49 @@ axios.get('/user/12345', {
|
|
|
1487
1583
|
cancel();
|
|
1488
1584
|
```
|
|
1489
1585
|
|
|
1490
|
-
|
|
1491
|
-
|
|
1586
|
+
`CancelToken` also exposes low-level helpers for legacy integrations:
|
|
1587
|
+
|
|
1588
|
+
```js
|
|
1589
|
+
const source = axios.CancelToken.source();
|
|
1590
|
+
|
|
1591
|
+
const listener = (cancel) => {
|
|
1592
|
+
console.log(cancel.message);
|
|
1593
|
+
};
|
|
1594
|
+
|
|
1595
|
+
source.token.subscribe(listener);
|
|
1596
|
+
|
|
1597
|
+
const signal = source.token.toAbortSignal();
|
|
1598
|
+
// Pass `signal` to APIs that accept AbortSignal.
|
|
1599
|
+
|
|
1600
|
+
source.cancel('Operation canceled by the user.');
|
|
1601
|
+
source.token.unsubscribe(listener);
|
|
1602
|
+
```
|
|
1603
|
+
|
|
1604
|
+
Canceled requests reject with `axios.CanceledError`. The legacy `axios.Cancel` export is an alias of `axios.CanceledError`, and cancellation errors include `__CANCEL__` for `axios.isCancel` compatibility.
|
|
1605
|
+
|
|
1606
|
+
> Note: You can cancel several requests with the same cancel token or abort controller.
|
|
1607
|
+
> If a cancellation token is already cancelled when an Axios request starts, Axios cancels the request immediately without making a real request.
|
|
1492
1608
|
|
|
1493
1609
|
> During the transition period, you can use both cancellation APIs, even for the same request:
|
|
1494
1610
|
|
|
1611
|
+
```js
|
|
1612
|
+
const controller = new AbortController();
|
|
1613
|
+
const source = axios.CancelToken.source();
|
|
1614
|
+
|
|
1615
|
+
axios.get('/user/12345', {
|
|
1616
|
+
cancelToken: source.token,
|
|
1617
|
+
signal: controller.signal,
|
|
1618
|
+
});
|
|
1619
|
+
|
|
1620
|
+
controller.abort();
|
|
1621
|
+
source.cancel('Operation canceled by the user.');
|
|
1622
|
+
```
|
|
1623
|
+
|
|
1495
1624
|
## Using `application/x-www-form-urlencoded` format
|
|
1496
1625
|
|
|
1497
1626
|
### URLSearchParams
|
|
1498
1627
|
|
|
1499
|
-
By default, axios serializes JavaScript objects to `JSON`. To send data
|
|
1628
|
+
By default, axios serializes JavaScript objects to `JSON`. To send data as [`application/x-www-form-urlencoded`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST), use the [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams) API. It works in most browsers and in [Node](https://nodejs.org/api/url.html#url_class_urlsearchparams) v10 and later.
|
|
1500
1629
|
|
|
1501
1630
|
```js
|
|
1502
1631
|
const params = new URLSearchParams({ foo: 'bar' });
|
|
@@ -1504,9 +1633,9 @@ params.append('extraparam', 'value');
|
|
|
1504
1633
|
axios.post('/foo', params);
|
|
1505
1634
|
```
|
|
1506
1635
|
|
|
1507
|
-
### Query string (
|
|
1636
|
+
### Query string (older browsers)
|
|
1508
1637
|
|
|
1509
|
-
For
|
|
1638
|
+
For very old browsers, use a [polyfill](https://github.com/WebReflection/url-search-params) and make sure it patches the global environment.
|
|
1510
1639
|
|
|
1511
1640
|
Alternatively, you can encode data using the [`qs`](https://github.com/ljharb/qs) library:
|
|
1512
1641
|
|
|
@@ -1515,7 +1644,7 @@ const qs = require('qs');
|
|
|
1515
1644
|
axios.post('/foo', qs.stringify({ bar: 123 }));
|
|
1516
1645
|
```
|
|
1517
1646
|
|
|
1518
|
-
|
|
1647
|
+
With ES modules:
|
|
1519
1648
|
|
|
1520
1649
|
```js
|
|
1521
1650
|
import qs from 'qs';
|
|
@@ -1531,7 +1660,7 @@ axios(options);
|
|
|
1531
1660
|
|
|
1532
1661
|
### Older Node.js versions
|
|
1533
1662
|
|
|
1534
|
-
For older Node.js engines,
|
|
1663
|
+
For older Node.js engines, use the [`querystring`](https://nodejs.org/api/querystring.html) module:
|
|
1535
1664
|
|
|
1536
1665
|
```js
|
|
1537
1666
|
const querystring = require('querystring');
|
|
@@ -1540,11 +1669,11 @@ axios.post('https://something.com/', querystring.stringify({ foo: 'bar' }));
|
|
|
1540
1669
|
|
|
1541
1670
|
You can also use the [`qs`](https://github.com/ljharb/qs) library.
|
|
1542
1671
|
|
|
1543
|
-
>
|
|
1672
|
+
> Note: The `qs` library is preferable if you need to stringify nested objects, as the `querystring` method has [known issues](https://github.com/nodejs/node-v0.x-archive/issues/1665) with that use case.
|
|
1544
1673
|
|
|
1545
|
-
###
|
|
1674
|
+
### Automatic serialization to URLSearchParams
|
|
1546
1675
|
|
|
1547
|
-
Axios
|
|
1676
|
+
Axios automatically serializes the data object to urlencoded format if the content-type header is set to "application/x-www-form-urlencoded".
|
|
1548
1677
|
|
|
1549
1678
|
```js
|
|
1550
1679
|
const data = {
|
|
@@ -1562,7 +1691,7 @@ await axios.postForm('https://postman-echo.com/post', data, {
|
|
|
1562
1691
|
});
|
|
1563
1692
|
```
|
|
1564
1693
|
|
|
1565
|
-
The server
|
|
1694
|
+
The server receives these fields:
|
|
1566
1695
|
|
|
1567
1696
|
```js
|
|
1568
1697
|
{
|
|
@@ -1579,7 +1708,7 @@ The server will handle it as:
|
|
|
1579
1708
|
}
|
|
1580
1709
|
```
|
|
1581
1710
|
|
|
1582
|
-
If your backend body
|
|
1711
|
+
If your backend body parser, such as `body-parser` for `express.js`, supports nested object decoding, the server receives the same object structure:
|
|
1583
1712
|
|
|
1584
1713
|
```js
|
|
1585
1714
|
const app = express();
|
|
@@ -1598,8 +1727,9 @@ server = app.listen(3000);
|
|
|
1598
1727
|
|
|
1599
1728
|
### FormData
|
|
1600
1729
|
|
|
1601
|
-
To send
|
|
1602
|
-
|
|
1730
|
+
To send data as `multipart/form-data`, pass a FormData instance as the payload.
|
|
1731
|
+
You do not need to set the `Content-Type` header. Axios detects it from the payload type.
|
|
1732
|
+
For browser, web worker, and React Native `FormData`, leave `Content-Type` unset so the runtime can add the multipart boundary.
|
|
1603
1733
|
|
|
1604
1734
|
```js
|
|
1605
1735
|
const formData = new FormData();
|
|
@@ -1608,7 +1738,7 @@ formData.append('foo', 'bar');
|
|
|
1608
1738
|
axios.post('https://httpbin.org/post', formData);
|
|
1609
1739
|
```
|
|
1610
1740
|
|
|
1611
|
-
In node.js,
|
|
1741
|
+
In node.js, use the [`form-data`](https://github.com/form-data/form-data) library:
|
|
1612
1742
|
|
|
1613
1743
|
```js
|
|
1614
1744
|
const FormData = require('form-data');
|
|
@@ -1623,12 +1753,12 @@ axios.post('https://example.com', form);
|
|
|
1623
1753
|
|
|
1624
1754
|
In node.js, when a `FormData` object provides `getHeaders()`, axios copies all returned headers by default for v1 compatibility. If the `FormData` object is custom or not fully trusted, set `formDataHeaderPolicy: 'content-only'` to copy only `Content-Type` and `Content-Length`, and set any other request headers explicitly with the request `headers` config.
|
|
1625
1755
|
|
|
1626
|
-
###
|
|
1756
|
+
### Automatic serialization to FormData
|
|
1627
1757
|
|
|
1628
|
-
|
|
1758
|
+
Since `v0.27.0`, Axios can serialize an object to FormData if the request `Content-Type`
|
|
1629
1759
|
header is set to `multipart/form-data`.
|
|
1630
1760
|
|
|
1631
|
-
|
|
1761
|
+
This request submits data as FormData in browsers and Node.js:
|
|
1632
1762
|
|
|
1633
1763
|
```js
|
|
1634
1764
|
import axios from 'axios';
|
|
@@ -1646,10 +1776,9 @@ axios
|
|
|
1646
1776
|
.then(({ data }) => console.log(data));
|
|
1647
1777
|
```
|
|
1648
1778
|
|
|
1649
|
-
|
|
1779
|
+
The Node.js build uses the [`form-data`](https://github.com/form-data/form-data) polyfill by default.
|
|
1650
1780
|
|
|
1651
|
-
You can
|
|
1652
|
-
but you probably won't need it in most cases:
|
|
1781
|
+
You can override the FormData class with the `env.FormData` config option, but most applications do not need this:
|
|
1653
1782
|
|
|
1654
1783
|
```js
|
|
1655
1784
|
const axios = require('axios');
|
|
@@ -1668,31 +1797,34 @@ axios
|
|
|
1668
1797
|
.then(({ data }) => console.log(data));
|
|
1669
1798
|
```
|
|
1670
1799
|
|
|
1671
|
-
Axios FormData serializer supports
|
|
1800
|
+
The Axios FormData serializer supports these special endings:
|
|
1672
1801
|
|
|
1673
1802
|
- `{}` - serialize the value with JSON.stringify
|
|
1674
1803
|
- `[]` - unwrap the array-like object as separate fields with the same key
|
|
1675
1804
|
|
|
1676
|
-
>
|
|
1805
|
+
> Note: Arrays and FileList objects are unwrapped by default.
|
|
1677
1806
|
|
|
1678
1807
|
FormData serializer supports additional options via `config.formSerializer: object` property to handle rare cases:
|
|
1679
1808
|
|
|
1680
|
-
- `visitor: Function` - user-defined visitor function that
|
|
1809
|
+
- `visitor: Function` - user-defined visitor function that Axios calls recursively to serialize the data object
|
|
1681
1810
|
to a `FormData` object by following custom rules.
|
|
1682
1811
|
|
|
1683
1812
|
- `dots: boolean = false` - use dot notation instead of brackets to serialize arrays and objects;
|
|
1684
1813
|
|
|
1685
1814
|
- `metaTokens: boolean = true` - add the special ending (e.g `user{}: '{"name": "John"}'`) in the FormData key.
|
|
1686
|
-
|
|
1815
|
+
A backend body parser can use this meta-information to parse the value as JSON.
|
|
1687
1816
|
|
|
1688
|
-
- `indexes: null|false|true = false` - controls how
|
|
1817
|
+
- `indexes: null|false|true = false` - controls how Axios adds indexes to unwrapped keys of `flat` array-like objects.
|
|
1689
1818
|
- `null` - don't add brackets (`arr: 1`, `arr: 2`, `arr: 3`)
|
|
1690
1819
|
- `false`(default) - add empty brackets (`arr[]: 1`, `arr[]: 2`, `arr[]: 3`)
|
|
1691
1820
|
- `true` - add brackets with indexes (`arr[0]: 1`, `arr[1]: 2`, `arr[2]: 3`)
|
|
1692
1821
|
- `maxDepth: number = 100` - maximum object nesting depth the serializer will recurse into. If the
|
|
1693
1822
|
input object exceeds this depth, an `AxiosError` with `code: 'ERR_FORM_DATA_DEPTH_EXCEEDED'` is
|
|
1694
|
-
thrown instead of overflowing the call stack. This protects server
|
|
1823
|
+
thrown instead of overflowing the call stack. This protects server applications from DoS
|
|
1695
1824
|
attacks via deeply nested payloads. Set to `Infinity` to disable the limit and restore pre-fix behaviour.
|
|
1825
|
+
- `Blob: typeof Blob` - Blob constructor used when converting ArrayBuffer-like values for spec-compliant
|
|
1826
|
+
`FormData`. Override it only for runtimes that provide a compatible `Blob` constructor under a
|
|
1827
|
+
different binding.
|
|
1696
1828
|
|
|
1697
1829
|
```js
|
|
1698
1830
|
// Raise the limit for a schema that genuinely nests deeper than 100 levels:
|
|
@@ -1702,7 +1834,7 @@ axios.postForm('/api', data, { formSerializer: { maxDepth: 200 } });
|
|
|
1702
1834
|
axios.get('/api', { params: data, paramsSerializer: { maxDepth: 200 } });
|
|
1703
1835
|
```
|
|
1704
1836
|
|
|
1705
|
-
|
|
1837
|
+
Given this object:
|
|
1706
1838
|
|
|
1707
1839
|
```js
|
|
1708
1840
|
const obj = {
|
|
@@ -1717,7 +1849,7 @@ const obj = {
|
|
|
1717
1849
|
};
|
|
1718
1850
|
```
|
|
1719
1851
|
|
|
1720
|
-
The
|
|
1852
|
+
The Axios serializer appends these fields:
|
|
1721
1853
|
|
|
1722
1854
|
```js
|
|
1723
1855
|
const formData = new FormData();
|
|
@@ -1735,12 +1867,11 @@ formData.append('users[1][surname]', 'Anderson');
|
|
|
1735
1867
|
formData.append('obj2{}', '[{"x":1}]');
|
|
1736
1868
|
```
|
|
1737
1869
|
|
|
1738
|
-
Axios supports
|
|
1739
|
-
which are just the corresponding http methods with the `Content-Type` header preset to `multipart/form-data`.
|
|
1870
|
+
Axios supports `postForm`, `putForm`, and `patchForm` as shortcuts for the matching HTTP methods with the `Content-Type` header preset to `multipart/form-data`.
|
|
1740
1871
|
|
|
1741
|
-
##
|
|
1872
|
+
## Posting files
|
|
1742
1873
|
|
|
1743
|
-
|
|
1874
|
+
Submit a single file:
|
|
1744
1875
|
|
|
1745
1876
|
```js
|
|
1746
1877
|
await axios.postForm('https://httpbin.org/post', {
|
|
@@ -1763,9 +1894,9 @@ await axios.postForm('https://httpbin.org/post', {
|
|
|
1763
1894
|
await axios.postForm('https://httpbin.org/post', document.querySelector('#fileInput').files);
|
|
1764
1895
|
```
|
|
1765
1896
|
|
|
1766
|
-
|
|
1897
|
+
Axios sends all files with the same field name: `files[]`.
|
|
1767
1898
|
|
|
1768
|
-
##
|
|
1899
|
+
## HTML form posting (browser)
|
|
1769
1900
|
|
|
1770
1901
|
Pass an HTML Form element as a payload to submit it as `multipart/form-data` content.
|
|
1771
1902
|
|
|
@@ -1803,7 +1934,7 @@ For example, the Form
|
|
|
1803
1934
|
</form>
|
|
1804
1935
|
```
|
|
1805
1936
|
|
|
1806
|
-
|
|
1937
|
+
submits this JSON object:
|
|
1807
1938
|
|
|
1808
1939
|
```js
|
|
1809
1940
|
{
|
|
@@ -1825,10 +1956,10 @@ will be submitted as the following JSON object:
|
|
|
1825
1956
|
|
|
1826
1957
|
Sending `Blobs`/`Files` as JSON (`base64`) is not currently supported.
|
|
1827
1958
|
|
|
1828
|
-
##
|
|
1959
|
+
## Progress capturing
|
|
1829
1960
|
|
|
1830
|
-
Axios
|
|
1831
|
-
|
|
1961
|
+
Axios can capture request upload and download progress in browsers and Node.js.
|
|
1962
|
+
Progress events are limited to `3` times per second.
|
|
1832
1963
|
|
|
1833
1964
|
```js
|
|
1834
1965
|
await axios.post(url, data, {
|
|
@@ -1874,14 +2005,14 @@ const { data } = await axios.post(SERVER_URL, readableStream, {
|
|
|
1874
2005
|
});
|
|
1875
2006
|
```
|
|
1876
2007
|
|
|
1877
|
-
>
|
|
2008
|
+
> Note:
|
|
1878
2009
|
> Capturing FormData upload progress is not currently supported in node.js environments.
|
|
1879
2010
|
|
|
1880
|
-
>
|
|
1881
|
-
>
|
|
1882
|
-
>
|
|
2011
|
+
> Warning:
|
|
2012
|
+
> Set `maxRedirects: 0` when uploading streams in node.js.
|
|
2013
|
+
> The follow-redirects package buffers the entire stream in RAM and does not follow the "backpressure" algorithm.
|
|
1883
2014
|
|
|
1884
|
-
##
|
|
2015
|
+
## Rate limiting
|
|
1885
2016
|
|
|
1886
2017
|
Download and upload rate limits can only be set for the http adapter (node.js):
|
|
1887
2018
|
|
|
@@ -1895,25 +2026,24 @@ const { data } = await axios.post(LOCAL_SERVER_URL, myBuffer, {
|
|
|
1895
2026
|
});
|
|
1896
2027
|
```
|
|
1897
2028
|
|
|
1898
|
-
##
|
|
2029
|
+
## AxiosHeaders
|
|
1899
2030
|
|
|
1900
|
-
Axios
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
The old approach of directly manipulating the headers object is still available, but deprecated and not recommended for future usage.
|
|
2031
|
+
Axios includes an `AxiosHeaders` class for working with headers through a Map-like API.
|
|
2032
|
+
HTTP header names are case-insensitive, but Axios keeps the original header case for style and for servers that incorrectly depend on case.
|
|
2033
|
+
Directly manipulating the headers object still works, but it is deprecated.
|
|
1904
2034
|
|
|
1905
2035
|
### Working with headers
|
|
1906
2036
|
|
|
1907
|
-
An AxiosHeaders
|
|
1908
|
-
|
|
2037
|
+
An `AxiosHeaders` instance can contain several internal value types that control setting and merging.
|
|
2038
|
+
Axios gets the final headers object with string values by calling `toJSON`.
|
|
1909
2039
|
|
|
1910
2040
|
> Note: By JSON here we mean an object consisting only of string values intended to be sent over the network.
|
|
1911
2041
|
|
|
1912
2042
|
The header value can be one of the following types:
|
|
1913
2043
|
|
|
1914
|
-
- `string` - normal string value
|
|
2044
|
+
- `string` - normal string value sent to the server
|
|
1915
2045
|
- `null` - skip header when rendering to JSON
|
|
1916
|
-
- `false` - skip header when rendering to JSON
|
|
2046
|
+
- `false` - skip header when rendering to JSON. Also indicates that the `set` method must be called with `rewrite` set to `true`
|
|
1917
2047
|
to overwrite this value (Axios uses this internally to allow users to opt out of installing certain headers like `User-Agent` or `Content-Type`)
|
|
1918
2048
|
- `undefined` - value is not set
|
|
1919
2049
|
|
|
@@ -1930,7 +2060,7 @@ axios.interceptors.request.use((request: InternalAxiosRequestConfig) => {
|
|
|
1930
2060
|
'My-set-header2': 'my-set-value2',
|
|
1931
2061
|
});
|
|
1932
2062
|
|
|
1933
|
-
request.headers.set('User-Agent', false); //
|
|
2063
|
+
request.headers.set('User-Agent', false); // prevent Axios from setting this header later
|
|
1934
2064
|
|
|
1935
2065
|
request.headers.setContentType('text/plain');
|
|
1936
2066
|
|
|
@@ -1998,7 +2128,7 @@ Constructs a new `AxiosHeaders` instance.
|
|
|
1998
2128
|
constructor(headers?: RawAxiosHeaders | AxiosHeaders | string);
|
|
1999
2129
|
```
|
|
2000
2130
|
|
|
2001
|
-
If the headers object is a string,
|
|
2131
|
+
If the headers object is a string, Axios parses it as raw HTTP headers.
|
|
2002
2132
|
|
|
2003
2133
|
```js
|
|
2004
2134
|
const headers = new AxiosHeaders(`
|
|
@@ -2021,6 +2151,7 @@ console.log(headers);
|
|
|
2021
2151
|
set(headerName, value: Axios, rewrite?: boolean);
|
|
2022
2152
|
set(headerName, value, rewrite?: (this: AxiosHeaders, value: string, name: string, headers: RawAxiosHeaders) => boolean);
|
|
2023
2153
|
set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean);
|
|
2154
|
+
set(headers?: Iterable<[string, AxiosHeaderValue]>, rewrite?: boolean);
|
|
2024
2155
|
```
|
|
2025
2156
|
|
|
2026
2157
|
The `rewrite` argument controls the overwriting behavior:
|
|
@@ -2029,7 +2160,22 @@ The `rewrite` argument controls the overwriting behavior:
|
|
|
2029
2160
|
- `undefined` (default) - overwrite the header unless its value is set to `false`
|
|
2030
2161
|
- `true` - rewrite anyway
|
|
2031
2162
|
|
|
2032
|
-
The option can also accept a user-defined function that determines whether the value
|
|
2163
|
+
The option can also accept a user-defined function that determines whether to overwrite the value.
|
|
2164
|
+
|
|
2165
|
+
Empty or whitespace-only header names are ignored.
|
|
2166
|
+
|
|
2167
|
+
Iterable key/value pairs, such as a `Map`, are accepted:
|
|
2168
|
+
|
|
2169
|
+
```js
|
|
2170
|
+
const headers = new AxiosHeaders();
|
|
2171
|
+
|
|
2172
|
+
headers.set(
|
|
2173
|
+
new Map([
|
|
2174
|
+
['X-Trace-Id', 'abc123'],
|
|
2175
|
+
['Accept', 'application/json'],
|
|
2176
|
+
])
|
|
2177
|
+
);
|
|
2178
|
+
```
|
|
2033
2179
|
|
|
2034
2180
|
Returns `this`.
|
|
2035
2181
|
|
|
@@ -2093,7 +2239,7 @@ clear(matcher?: AxiosHeaderMatcher): boolean;
|
|
|
2093
2239
|
```
|
|
2094
2240
|
|
|
2095
2241
|
Removes all headers.
|
|
2096
|
-
Unlike the `delete` method matcher, this optional matcher
|
|
2242
|
+
Unlike the `delete` method matcher, this optional matcher matches the header name rather than the value.
|
|
2097
2243
|
|
|
2098
2244
|
```ts
|
|
2099
2245
|
const headers = new AxiosHeaders({
|
|
@@ -2137,19 +2283,28 @@ Returns `this`.
|
|
|
2137
2283
|
concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): AxiosHeaders;
|
|
2138
2284
|
```
|
|
2139
2285
|
|
|
2140
|
-
Merges the instance with targets into a new `AxiosHeaders` instance. If the target is a string,
|
|
2286
|
+
Merges the instance with targets into a new `AxiosHeaders` instance. If the target is a string, Axios parses it as raw HTTP headers.
|
|
2141
2287
|
|
|
2142
2288
|
Returns a new `AxiosHeaders` instance.
|
|
2143
2289
|
|
|
2144
2290
|
### AxiosHeaders#toJSON(asStrings?)
|
|
2145
2291
|
|
|
2146
2292
|
```
|
|
2147
|
-
toJSON(asStrings
|
|
2293
|
+
toJSON(asStrings: true): Record<string, string>;
|
|
2294
|
+
toJSON(asStrings?: false): Record<string, string | string[]>;
|
|
2148
2295
|
```
|
|
2149
2296
|
|
|
2150
|
-
|
|
2297
|
+
Resolves all internal header values into a new null prototype object.
|
|
2151
2298
|
Set `asStrings` to true to resolve arrays as a string containing all elements, separated by commas.
|
|
2152
2299
|
|
|
2300
|
+
### AxiosHeaders#toString()
|
|
2301
|
+
|
|
2302
|
+
```
|
|
2303
|
+
toString(): string;
|
|
2304
|
+
```
|
|
2305
|
+
|
|
2306
|
+
Returns the headers as a CRLF-free HTTP header block, one `name: value` pair per line.
|
|
2307
|
+
|
|
2153
2308
|
### AxiosHeaders.from(thing?)
|
|
2154
2309
|
|
|
2155
2310
|
```
|
|
@@ -2157,7 +2312,7 @@ from(thing?: AxiosHeaders | RawAxiosHeaders | string): AxiosHeaders;
|
|
|
2157
2312
|
```
|
|
2158
2313
|
|
|
2159
2314
|
Returns a new `AxiosHeaders` instance created from the raw headers passed in,
|
|
2160
|
-
or
|
|
2315
|
+
or returns the given headers object if it's already an `AxiosHeaders` instance.
|
|
2161
2316
|
|
|
2162
2317
|
### AxiosHeaders.concat(...targets)
|
|
2163
2318
|
|
|
@@ -2181,11 +2336,10 @@ The following shortcuts are available:
|
|
|
2181
2336
|
|
|
2182
2337
|
- `setContentEncoding`, `getContentEncoding`, `hasContentEncoding`
|
|
2183
2338
|
|
|
2184
|
-
##
|
|
2339
|
+
## Fetch adapter
|
|
2185
2340
|
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
To use it by default, it must be selected explicitly:
|
|
2341
|
+
Axios introduced the fetch adapter in `v1.7.0`. By default, Axios uses it when the `xhr` and `http` adapters are not available in the build or not supported by the environment.
|
|
2342
|
+
To use it by default, select it explicitly:
|
|
2189
2343
|
|
|
2190
2344
|
```js
|
|
2191
2345
|
const { data } = axios.get(url, {
|
|
@@ -2203,20 +2357,21 @@ const fetchAxios = axios.create({
|
|
|
2203
2357
|
const { data } = fetchAxios.get(url);
|
|
2204
2358
|
```
|
|
2205
2359
|
|
|
2206
|
-
The adapter supports the same
|
|
2207
|
-
|
|
2360
|
+
The adapter supports the same features as the `xhr` adapter, including upload and download progress capturing.
|
|
2361
|
+
It also supports response types such as `stream` and `formdata` when the environment supports them.
|
|
2362
|
+
|
|
2363
|
+
When `auth` is omitted, the fetch adapter can read HTTP Basic auth credentials from the request URL, for example `https://user:pass@example.com`. Percent-encoded URL credentials are decoded before the `Authorization` header is generated, and `auth` takes precedence over URL-embedded credentials.
|
|
2208
2364
|
|
|
2209
|
-
###
|
|
2365
|
+
### Custom fetch
|
|
2210
2366
|
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
This
|
|
2367
|
+
Since `v1.12.0`, you can configure the fetch adapter to use a custom fetch API instead of environment globals.
|
|
2368
|
+
Pass a custom `fetch` function, `Request`, and `Response` constructors through `env` config.
|
|
2369
|
+
This helps in custom environments and app frameworks.
|
|
2214
2370
|
|
|
2215
|
-
|
|
2216
|
-
If your custom fetch
|
|
2217
|
-
you must disable their use inside the fetch adapter by passing null.
|
|
2371
|
+
When using a custom fetch, you may also need to set custom `Request` and `Response` constructors. If you do not set them, Axios uses the global objects.
|
|
2372
|
+
If your custom fetch API does not provide these objects and the globals are incompatible with it, pass `null` to disable them inside the fetch adapter.
|
|
2218
2373
|
|
|
2219
|
-
> Note: Setting `Request`
|
|
2374
|
+
> Note: Setting `Request` and `Response` to `null` prevents the fetch adapter from capturing upload and download progress.
|
|
2220
2375
|
|
|
2221
2376
|
Basic example:
|
|
2222
2377
|
|
|
@@ -2236,7 +2391,7 @@ const instance = axios.create({
|
|
|
2236
2391
|
});
|
|
2237
2392
|
```
|
|
2238
2393
|
|
|
2239
|
-
####
|
|
2394
|
+
#### Using with Tauri
|
|
2240
2395
|
|
|
2241
2396
|
A minimal example of setting up Axios for use in a [Tauri](https://tauri.app/plugin/http-client/) app with a platform fetch function that ignores CORS policy for requests.
|
|
2242
2397
|
|
|
@@ -2257,10 +2412,9 @@ const instance = axios.create({
|
|
|
2257
2412
|
const { data } = await instance.get('https://google.com');
|
|
2258
2413
|
```
|
|
2259
2414
|
|
|
2260
|
-
####
|
|
2415
|
+
#### Using with SvelteKit
|
|
2261
2416
|
|
|
2262
|
-
[SvelteKit](https://svelte.dev/docs/kit/web-standards#Fetch-APIs)
|
|
2263
|
-
which makes it incompatible with the standard URL API. So, Axios must be configured to use the custom fetch API:
|
|
2417
|
+
[SvelteKit](https://svelte.dev/docs/kit/web-standards#Fetch-APIs) uses a custom fetch function for server rendering in `load` functions. It also uses relative paths, which are incompatible with the standard URL API. Configure Axios to use SvelteKit's custom fetch API:
|
|
2264
2418
|
|
|
2265
2419
|
```js
|
|
2266
2420
|
export async function load({ fetch }) {
|
|
@@ -2277,13 +2431,13 @@ export async function load({ fetch }) {
|
|
|
2277
2431
|
}
|
|
2278
2432
|
```
|
|
2279
2433
|
|
|
2280
|
-
#### HTTP/2
|
|
2434
|
+
#### HTTP/2 support
|
|
2281
2435
|
|
|
2282
|
-
Axios supports HTTP/2
|
|
2436
|
+
Axios supports HTTP/2 through the Node.js `http` adapter, introduced in v1.13.0.
|
|
2283
2437
|
|
|
2284
|
-
|
|
2438
|
+
Support depends on the runtime environment. Axios relies on Node.js APIs, so HTTP/2 works in supported Node.js versions but may not work in other environments such as Bun or Deno.
|
|
2285
2439
|
|
|
2286
|
-
Options like `httpVersion` and `http2Options` are adapter-specific and may not behave
|
|
2440
|
+
Options like `httpVersion` and `http2Options` are adapter-specific and may not behave the same way in every environment.
|
|
2287
2441
|
|
|
2288
2442
|
Note: HTTP/2 redirects are currently not supported by the HTTP/2 adapter.
|
|
2289
2443
|
|
|
@@ -2305,7 +2459,7 @@ const { data, headers, status } = await axios.post('https://httpbin.org/post', f
|
|
|
2305
2459
|
|
|
2306
2460
|
## Semver
|
|
2307
2461
|
|
|
2308
|
-
|
|
2462
|
+
Axios follows [semver](https://semver.org/) since `v1.0.0`.
|
|
2309
2463
|
|
|
2310
2464
|
## Promises
|
|
2311
2465
|
|
|
@@ -2330,10 +2484,24 @@ try {
|
|
|
2330
2484
|
}
|
|
2331
2485
|
```
|
|
2332
2486
|
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2487
|
+
Use `axios.isCancel<T>()` to narrow cancellation errors to `CanceledError<T>`:
|
|
2488
|
+
|
|
2489
|
+
```typescript
|
|
2490
|
+
const controller = new AbortController();
|
|
2491
|
+
|
|
2492
|
+
try {
|
|
2493
|
+
await axios.get<User>('/user?ID=12345', { signal: controller.signal });
|
|
2494
|
+
} catch (error) {
|
|
2495
|
+
if (axios.isCancel<User>(error)) {
|
|
2496
|
+
handleCancellation(error);
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
```
|
|
2500
|
+
|
|
2501
|
+
Because axios publishes an ESM default export and a CJS `module.exports`, TypeScript has a few caveats.
|
|
2502
|
+
The recommended setting is `"moduleResolution": "node16"`, which is implied by `"module": "node16"`. This requires TypeScript 4.7 or greater.
|
|
2503
|
+
If you use ESM, your settings should be fine.
|
|
2504
|
+
If you compile TypeScript to CJS and can't use `"moduleResolution": "node 16"`, enable `esModuleInterop`.
|
|
2337
2505
|
If you use TypeScript to type check CJS JavaScript code, your only option is to use `"moduleResolution": "node16"`.
|
|
2338
2506
|
|
|
2339
2507
|
You can also create a custom instance with typed interceptors:
|
|
@@ -2354,7 +2522,7 @@ apiClient.interceptors.request.use((config: InternalAxiosRequestConfig) => {
|
|
|
2354
2522
|
|
|
2355
2523
|
## Online one-click setup
|
|
2356
2524
|
|
|
2357
|
-
You can use Gitpod,
|
|
2525
|
+
You can use Gitpod, a free online IDE for open source projects, to contribute or run the examples online.
|
|
2358
2526
|
|
|
2359
2527
|
[](https://gitpod.io/#https://github.com/axios/axios/blob/main/examples/server.js)
|
|
2360
2528
|
|
|
@@ -2373,7 +2541,7 @@ npm rebuild husky && npx husky
|
|
|
2373
2541
|
|
|
2374
2542
|
Run those two commands once per fresh checkout. You do **not** need to re-run them after every subsequent `npm install`.
|
|
2375
2543
|
|
|
2376
|
-
Do not remove `ignore-scripts=true` from `.npmrc` to "fix" this
|
|
2544
|
+
Do not remove `ignore-scripts=true` from `.npmrc` to "fix" this. That reopens the lifecycle-script attack surface for every other package in the tree. All CI workflows already invoke npm with `--ignore-scripts`, so local behaviour matches CI.
|
|
2377
2545
|
|
|
2378
2546
|
## Resources
|
|
2379
2547
|
|
|
@@ -2384,7 +2552,7 @@ Do not remove `ignore-scripts=true` from `.npmrc` to "fix" this — that re-open
|
|
|
2384
2552
|
|
|
2385
2553
|
## Credits
|
|
2386
2554
|
|
|
2387
|
-
axios is heavily inspired by the [$http service](https://docs.angularjs.org/api/ng/service/$http)
|
|
2555
|
+
axios is heavily inspired by the [$http service](https://docs.angularjs.org/api/ng/service/$http) in [AngularJS](https://angularjs.org/). It provides a standalone `$http`-like service for use outside AngularJS.
|
|
2388
2556
|
|
|
2389
2557
|
## License
|
|
2390
2558
|
|