@teammy/server 0.1.4 → 0.1.5

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.
Files changed (444) hide show
  1. package/dist/main.js +682 -24
  2. package/dist/web/assets/Assistant-Dm_p8EZl.js +1 -0
  3. package/dist/web/assets/{Dashboard-dCu2Cdxd.js → Dashboard-fwW9NxcC.js} +1 -1
  4. package/dist/web/assets/{Files-cRhoWviM.js → Files-D-KCDWmO.js} +1 -1
  5. package/dist/web/assets/{Markdown-Bq8P_NBV.js → Markdown-oZagG-wy.js} +1 -1
  6. package/dist/web/assets/{Sessions-BxHsX1C5.js → Sessions-BQhGiLvz.js} +1 -1
  7. package/dist/web/assets/{WorkspaceTree-CD94JsaJ.js → WorkspaceTree-B9733pV3.js} +1 -1
  8. package/dist/web/assets/{file-links-CFCIacLV.js → file-links-CD346_jf.js} +1 -1
  9. package/dist/web/assets/{index-B-MqU_88.css → index-Be5hGscJ.css} +1 -1
  10. package/dist/web/assets/index-BiiPuwDi.js +66 -0
  11. package/dist/web/index.html +2 -2
  12. package/node_modules/@wecom/aibot-node-sdk/README.md +786 -0
  13. package/node_modules/@wecom/aibot-node-sdk/dist/api.d.ts +17 -0
  14. package/node_modules/@wecom/aibot-node-sdk/dist/client.d.ts +217 -0
  15. package/node_modules/@wecom/aibot-node-sdk/dist/crypto.d.ts +12 -0
  16. package/node_modules/@wecom/aibot-node-sdk/dist/index.cjs.js +1563 -0
  17. package/node_modules/@wecom/aibot-node-sdk/dist/index.cjs.js.map +1 -0
  18. package/node_modules/@wecom/aibot-node-sdk/dist/index.d.ts +1324 -0
  19. package/node_modules/@wecom/aibot-node-sdk/dist/index.esm.js +1544 -0
  20. package/node_modules/@wecom/aibot-node-sdk/dist/index.esm.js.map +1 -0
  21. package/node_modules/@wecom/aibot-node-sdk/dist/logger.d.ts +14 -0
  22. package/node_modules/@wecom/aibot-node-sdk/dist/message-handler.d.ts +29 -0
  23. package/node_modules/@wecom/aibot-node-sdk/dist/types/api.d.ts +466 -0
  24. package/node_modules/@wecom/aibot-node-sdk/dist/types/common.d.ts +30 -0
  25. package/node_modules/@wecom/aibot-node-sdk/dist/types/config.d.ts +34 -0
  26. package/node_modules/@wecom/aibot-node-sdk/dist/types/event.d.ts +109 -0
  27. package/node_modules/@wecom/aibot-node-sdk/dist/types/index.d.ts +10 -0
  28. package/node_modules/@wecom/aibot-node-sdk/dist/types/message.d.ts +158 -0
  29. package/node_modules/@wecom/aibot-node-sdk/dist/utils.d.ts +19 -0
  30. package/node_modules/@wecom/aibot-node-sdk/dist/wecom-crypto/index.d.ts +46 -0
  31. package/node_modules/@wecom/aibot-node-sdk/dist/ws.d.ts +161 -0
  32. package/node_modules/@wecom/aibot-node-sdk/package.json +43 -0
  33. package/node_modules/asynckit/LICENSE +21 -0
  34. package/node_modules/asynckit/README.md +233 -0
  35. package/node_modules/asynckit/bench.js +76 -0
  36. package/node_modules/asynckit/index.js +6 -0
  37. package/node_modules/asynckit/lib/abort.js +29 -0
  38. package/node_modules/asynckit/lib/async.js +34 -0
  39. package/node_modules/asynckit/lib/defer.js +26 -0
  40. package/node_modules/asynckit/lib/iterate.js +75 -0
  41. package/node_modules/asynckit/lib/readable_asynckit.js +91 -0
  42. package/node_modules/asynckit/lib/readable_parallel.js +25 -0
  43. package/node_modules/asynckit/lib/readable_serial.js +25 -0
  44. package/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
  45. package/node_modules/asynckit/lib/state.js +37 -0
  46. package/node_modules/asynckit/lib/streamify.js +141 -0
  47. package/node_modules/asynckit/lib/terminator.js +29 -0
  48. package/node_modules/asynckit/package.json +63 -0
  49. package/node_modules/asynckit/parallel.js +43 -0
  50. package/node_modules/asynckit/serial.js +17 -0
  51. package/node_modules/asynckit/serialOrdered.js +75 -0
  52. package/node_modules/asynckit/stream.js +21 -0
  53. package/node_modules/axios/CHANGELOG.md +1934 -0
  54. package/node_modules/axios/LICENSE +7 -0
  55. package/node_modules/axios/MIGRATION_GUIDE.md +877 -0
  56. package/node_modules/axios/README.md +2786 -0
  57. package/node_modules/axios/dist/axios.js +6460 -0
  58. package/node_modules/axios/dist/axios.min.js +5 -0
  59. package/node_modules/axios/dist/axios.min.js.map +1 -0
  60. package/node_modules/axios/dist/browser/axios.cjs +6509 -0
  61. package/node_modules/axios/dist/esm/axios.js +6530 -0
  62. package/node_modules/axios/dist/esm/axios.min.js +3 -0
  63. package/node_modules/axios/dist/esm/axios.min.js.map +1 -0
  64. package/node_modules/axios/dist/node/axios.cjs +7491 -0
  65. package/node_modules/axios/index.d.cts +785 -0
  66. package/node_modules/axios/index.d.ts +804 -0
  67. package/node_modules/axios/index.js +45 -0
  68. package/node_modules/axios/lib/adapters/README.md +36 -0
  69. package/node_modules/axios/lib/adapters/adapters.js +132 -0
  70. package/node_modules/axios/lib/adapters/fetch.js +749 -0
  71. package/node_modules/axios/lib/adapters/http.js +1609 -0
  72. package/node_modules/axios/lib/adapters/xhr.js +384 -0
  73. package/node_modules/axios/lib/axios.js +89 -0
  74. package/node_modules/axios/lib/cancel/CancelToken.js +135 -0
  75. package/node_modules/axios/lib/cancel/CanceledError.js +22 -0
  76. package/node_modules/axios/lib/cancel/isCancel.js +5 -0
  77. package/node_modules/axios/lib/core/Axios.js +361 -0
  78. package/node_modules/axios/lib/core/AxiosError.js +278 -0
  79. package/node_modules/axios/lib/core/AxiosHeaders.js +487 -0
  80. package/node_modules/axios/lib/core/InterceptorManager.js +182 -0
  81. package/node_modules/axios/lib/core/README.md +8 -0
  82. package/node_modules/axios/lib/core/assertParamsAcyclic.js +49 -0
  83. package/node_modules/axios/lib/core/buildFullPath.js +76 -0
  84. package/node_modules/axios/lib/core/createMultipartBody.js +37 -0
  85. package/node_modules/axios/lib/core/dispatchRequest.js +115 -0
  86. package/node_modules/axios/lib/core/mergeConfig.js +237 -0
  87. package/node_modules/axios/lib/core/methodList.js +17 -0
  88. package/node_modules/axios/lib/core/setFormDataHeaders.js +27 -0
  89. package/node_modules/axios/lib/core/settle.js +27 -0
  90. package/node_modules/axios/lib/core/transformData.js +28 -0
  91. package/node_modules/axios/lib/defaults/index.js +178 -0
  92. package/node_modules/axios/lib/defaults/transitional.js +11 -0
  93. package/node_modules/axios/lib/env/README.md +3 -0
  94. package/node_modules/axios/lib/env/classes/FormData.js +2 -0
  95. package/node_modules/axios/lib/env/data.js +1 -0
  96. package/node_modules/axios/lib/helpers/AxiosTransformStream.js +165 -0
  97. package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +59 -0
  98. package/node_modules/axios/lib/helpers/Http2Sessions.js +122 -0
  99. package/node_modules/axios/lib/helpers/HttpStatusCode.js +88 -0
  100. package/node_modules/axios/lib/helpers/README.md +7 -0
  101. package/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js +29 -0
  102. package/node_modules/axios/lib/helpers/bind.js +14 -0
  103. package/node_modules/axios/lib/helpers/buildURL.js +69 -0
  104. package/node_modules/axios/lib/helpers/callbackify.js +18 -0
  105. package/node_modules/axios/lib/helpers/combineURLs.js +23 -0
  106. package/node_modules/axios/lib/helpers/composeSignals.js +71 -0
  107. package/node_modules/axios/lib/helpers/cookies.js +88 -0
  108. package/node_modules/axios/lib/helpers/deprecatedMethod.js +31 -0
  109. package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +193 -0
  110. package/node_modules/axios/lib/helpers/formDataToBlob.js +113 -0
  111. package/node_modules/axios/lib/helpers/formDataToJSON.js +149 -0
  112. package/node_modules/axios/lib/helpers/formDataToStream.js +119 -0
  113. package/node_modules/axios/lib/helpers/fromDataURI.js +75 -0
  114. package/node_modules/axios/lib/helpers/isAbsoluteURL.js +19 -0
  115. package/node_modules/axios/lib/helpers/isAxiosError.js +14 -0
  116. package/node_modules/axios/lib/helpers/isURLSameOrigin.js +11 -0
  117. package/node_modules/axios/lib/helpers/normalizeURLForProtocolCheck.js +24 -0
  118. package/node_modules/axios/lib/helpers/null.js +2 -0
  119. package/node_modules/axios/lib/helpers/parseHeaders.js +72 -0
  120. package/node_modules/axios/lib/helpers/parseProtocol.js +6 -0
  121. package/node_modules/axios/lib/helpers/progressEventReducer.js +54 -0
  122. package/node_modules/axios/lib/helpers/readBlob.js +15 -0
  123. package/node_modules/axios/lib/helpers/resolveConfig.js +120 -0
  124. package/node_modules/axios/lib/helpers/sanitizeHeaderValue.js +60 -0
  125. package/node_modules/axios/lib/helpers/shouldBypassProxy.js +520 -0
  126. package/node_modules/axios/lib/helpers/speedometer.js +55 -0
  127. package/node_modules/axios/lib/helpers/spread.js +28 -0
  128. package/node_modules/axios/lib/helpers/throttle.js +45 -0
  129. package/node_modules/axios/lib/helpers/toFormData.js +279 -0
  130. package/node_modules/axios/lib/helpers/toURLEncodedForm.js +19 -0
  131. package/node_modules/axios/lib/helpers/trackStream.js +89 -0
  132. package/node_modules/axios/lib/helpers/validator.js +112 -0
  133. package/node_modules/axios/lib/platform/browser/classes/Blob.js +3 -0
  134. package/node_modules/axios/lib/platform/browser/classes/FormData.js +3 -0
  135. package/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +4 -0
  136. package/node_modules/axios/lib/platform/browser/index.js +13 -0
  137. package/node_modules/axios/lib/platform/common/utils.js +52 -0
  138. package/node_modules/axios/lib/platform/index.js +7 -0
  139. package/node_modules/axios/lib/platform/node/classes/Buffer.js +11 -0
  140. package/node_modules/axios/lib/platform/node/classes/FormData.js +3 -0
  141. package/node_modules/axios/lib/platform/node/classes/URLSearchParams.js +4 -0
  142. package/node_modules/axios/lib/platform/node/index.js +37 -0
  143. package/node_modules/axios/lib/utils.js +1201 -0
  144. package/node_modules/axios/node_modules/agent-base/README.md +145 -0
  145. package/node_modules/axios/node_modules/agent-base/dist/src/index.d.ts +78 -0
  146. package/node_modules/axios/node_modules/agent-base/dist/src/index.js +203 -0
  147. package/node_modules/axios/node_modules/agent-base/dist/src/index.js.map +1 -0
  148. package/node_modules/axios/node_modules/agent-base/dist/src/promisify.d.ts +4 -0
  149. package/node_modules/axios/node_modules/agent-base/dist/src/promisify.js +18 -0
  150. package/node_modules/axios/node_modules/agent-base/dist/src/promisify.js.map +1 -0
  151. package/node_modules/axios/node_modules/agent-base/package.json +64 -0
  152. package/node_modules/axios/node_modules/agent-base/src/index.ts +345 -0
  153. package/node_modules/axios/node_modules/agent-base/src/promisify.ts +33 -0
  154. package/node_modules/axios/node_modules/https-proxy-agent/README.md +137 -0
  155. package/node_modules/axios/node_modules/https-proxy-agent/dist/agent.d.ts +30 -0
  156. package/node_modules/axios/node_modules/https-proxy-agent/dist/agent.js +177 -0
  157. package/node_modules/axios/node_modules/https-proxy-agent/dist/agent.js.map +1 -0
  158. package/node_modules/axios/node_modules/https-proxy-agent/dist/index.d.ts +23 -0
  159. package/node_modules/axios/node_modules/https-proxy-agent/dist/index.js +14 -0
  160. package/node_modules/axios/node_modules/https-proxy-agent/dist/index.js.map +1 -0
  161. package/node_modules/axios/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +7 -0
  162. package/node_modules/axios/node_modules/https-proxy-agent/dist/parse-proxy-response.js +66 -0
  163. package/node_modules/axios/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -0
  164. package/node_modules/axios/node_modules/https-proxy-agent/package.json +56 -0
  165. package/node_modules/axios/package.json +202 -0
  166. package/node_modules/call-bind-apply-helpers/.eslintrc +17 -0
  167. package/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +12 -0
  168. package/node_modules/call-bind-apply-helpers/.nycrc +9 -0
  169. package/node_modules/call-bind-apply-helpers/CHANGELOG.md +30 -0
  170. package/node_modules/call-bind-apply-helpers/LICENSE +21 -0
  171. package/node_modules/call-bind-apply-helpers/README.md +62 -0
  172. package/node_modules/call-bind-apply-helpers/actualApply.d.ts +1 -0
  173. package/node_modules/call-bind-apply-helpers/actualApply.js +10 -0
  174. package/node_modules/call-bind-apply-helpers/applyBind.d.ts +19 -0
  175. package/node_modules/call-bind-apply-helpers/applyBind.js +10 -0
  176. package/node_modules/call-bind-apply-helpers/functionApply.d.ts +1 -0
  177. package/node_modules/call-bind-apply-helpers/functionApply.js +4 -0
  178. package/node_modules/call-bind-apply-helpers/functionCall.d.ts +1 -0
  179. package/node_modules/call-bind-apply-helpers/functionCall.js +4 -0
  180. package/node_modules/call-bind-apply-helpers/index.d.ts +64 -0
  181. package/node_modules/call-bind-apply-helpers/index.js +15 -0
  182. package/node_modules/call-bind-apply-helpers/package.json +85 -0
  183. package/node_modules/call-bind-apply-helpers/reflectApply.d.ts +3 -0
  184. package/node_modules/call-bind-apply-helpers/reflectApply.js +4 -0
  185. package/node_modules/call-bind-apply-helpers/test/index.js +63 -0
  186. package/node_modules/call-bind-apply-helpers/tsconfig.json +9 -0
  187. package/node_modules/combined-stream/License +19 -0
  188. package/node_modules/combined-stream/Readme.md +138 -0
  189. package/node_modules/combined-stream/lib/combined_stream.js +208 -0
  190. package/node_modules/combined-stream/package.json +25 -0
  191. package/node_modules/delayed-stream/.npmignore +1 -0
  192. package/node_modules/delayed-stream/License +19 -0
  193. package/node_modules/delayed-stream/Makefile +7 -0
  194. package/node_modules/delayed-stream/Readme.md +141 -0
  195. package/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
  196. package/node_modules/delayed-stream/package.json +27 -0
  197. package/node_modules/dunder-proto/.eslintrc +5 -0
  198. package/node_modules/dunder-proto/.github/FUNDING.yml +12 -0
  199. package/node_modules/dunder-proto/.nycrc +13 -0
  200. package/node_modules/dunder-proto/CHANGELOG.md +24 -0
  201. package/node_modules/dunder-proto/LICENSE +21 -0
  202. package/node_modules/dunder-proto/README.md +54 -0
  203. package/node_modules/dunder-proto/get.d.ts +5 -0
  204. package/node_modules/dunder-proto/get.js +30 -0
  205. package/node_modules/dunder-proto/package.json +76 -0
  206. package/node_modules/dunder-proto/set.d.ts +5 -0
  207. package/node_modules/dunder-proto/set.js +35 -0
  208. package/node_modules/dunder-proto/test/get.js +34 -0
  209. package/node_modules/dunder-proto/test/index.js +4 -0
  210. package/node_modules/dunder-proto/test/set.js +50 -0
  211. package/node_modules/dunder-proto/tsconfig.json +9 -0
  212. package/node_modules/es-define-property/.eslintrc +13 -0
  213. package/node_modules/es-define-property/.github/FUNDING.yml +12 -0
  214. package/node_modules/es-define-property/.nycrc +9 -0
  215. package/node_modules/es-define-property/CHANGELOG.md +29 -0
  216. package/node_modules/es-define-property/LICENSE +21 -0
  217. package/node_modules/es-define-property/README.md +49 -0
  218. package/node_modules/es-define-property/index.d.ts +3 -0
  219. package/node_modules/es-define-property/index.js +14 -0
  220. package/node_modules/es-define-property/package.json +81 -0
  221. package/node_modules/es-define-property/test/index.js +56 -0
  222. package/node_modules/es-define-property/tsconfig.json +10 -0
  223. package/node_modules/es-errors/.eslintrc +5 -0
  224. package/node_modules/es-errors/.github/FUNDING.yml +12 -0
  225. package/node_modules/es-errors/CHANGELOG.md +40 -0
  226. package/node_modules/es-errors/LICENSE +21 -0
  227. package/node_modules/es-errors/README.md +55 -0
  228. package/node_modules/es-errors/eval.d.ts +3 -0
  229. package/node_modules/es-errors/eval.js +4 -0
  230. package/node_modules/es-errors/index.d.ts +3 -0
  231. package/node_modules/es-errors/index.js +4 -0
  232. package/node_modules/es-errors/package.json +80 -0
  233. package/node_modules/es-errors/range.d.ts +3 -0
  234. package/node_modules/es-errors/range.js +4 -0
  235. package/node_modules/es-errors/ref.d.ts +3 -0
  236. package/node_modules/es-errors/ref.js +4 -0
  237. package/node_modules/es-errors/syntax.d.ts +3 -0
  238. package/node_modules/es-errors/syntax.js +4 -0
  239. package/node_modules/es-errors/test/index.js +19 -0
  240. package/node_modules/es-errors/tsconfig.json +49 -0
  241. package/node_modules/es-errors/type.d.ts +3 -0
  242. package/node_modules/es-errors/type.js +4 -0
  243. package/node_modules/es-errors/uri.d.ts +3 -0
  244. package/node_modules/es-errors/uri.js +4 -0
  245. package/node_modules/es-object-atoms/.eslintrc +16 -0
  246. package/node_modules/es-object-atoms/.github/FUNDING.yml +12 -0
  247. package/node_modules/es-object-atoms/CHANGELOG.md +44 -0
  248. package/node_modules/es-object-atoms/LICENSE +21 -0
  249. package/node_modules/es-object-atoms/README.md +63 -0
  250. package/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +3 -0
  251. package/node_modules/es-object-atoms/RequireObjectCoercible.js +11 -0
  252. package/node_modules/es-object-atoms/ToObject.d.ts +7 -0
  253. package/node_modules/es-object-atoms/ToObject.js +10 -0
  254. package/node_modules/es-object-atoms/index.d.ts +3 -0
  255. package/node_modules/es-object-atoms/index.js +4 -0
  256. package/node_modules/es-object-atoms/isObject.d.ts +3 -0
  257. package/node_modules/es-object-atoms/isObject.js +6 -0
  258. package/node_modules/es-object-atoms/package.json +79 -0
  259. package/node_modules/es-object-atoms/test/index.js +38 -0
  260. package/node_modules/es-object-atoms/tsconfig.json +7 -0
  261. package/node_modules/es-set-tostringtag/.eslintrc +13 -0
  262. package/node_modules/es-set-tostringtag/.nycrc +9 -0
  263. package/node_modules/es-set-tostringtag/CHANGELOG.md +67 -0
  264. package/node_modules/es-set-tostringtag/LICENSE +21 -0
  265. package/node_modules/es-set-tostringtag/README.md +53 -0
  266. package/node_modules/es-set-tostringtag/index.d.ts +10 -0
  267. package/node_modules/es-set-tostringtag/index.js +35 -0
  268. package/node_modules/es-set-tostringtag/package.json +78 -0
  269. package/node_modules/es-set-tostringtag/test/index.js +85 -0
  270. package/node_modules/es-set-tostringtag/tsconfig.json +9 -0
  271. package/node_modules/eventemitter3/LICENSE +21 -0
  272. package/node_modules/eventemitter3/README.md +85 -0
  273. package/node_modules/eventemitter3/dist/eventemitter3.esm.js +355 -0
  274. package/node_modules/eventemitter3/dist/eventemitter3.esm.min.js +1 -0
  275. package/node_modules/eventemitter3/dist/eventemitter3.esm.min.js.map +1 -0
  276. package/node_modules/eventemitter3/dist/eventemitter3.umd.js +363 -0
  277. package/node_modules/eventemitter3/dist/eventemitter3.umd.min.js +1 -0
  278. package/node_modules/eventemitter3/dist/eventemitter3.umd.min.js.map +1 -0
  279. package/node_modules/eventemitter3/index.d.ts +135 -0
  280. package/node_modules/eventemitter3/index.js +336 -0
  281. package/node_modules/eventemitter3/index.mjs +4 -0
  282. package/node_modules/eventemitter3/package.json +62 -0
  283. package/node_modules/follow-redirects/LICENSE +18 -0
  284. package/node_modules/follow-redirects/README.md +183 -0
  285. package/node_modules/follow-redirects/debug.js +15 -0
  286. package/node_modules/follow-redirects/http.js +1 -0
  287. package/node_modules/follow-redirects/https.js +1 -0
  288. package/node_modules/follow-redirects/index.js +714 -0
  289. package/node_modules/follow-redirects/package.json +58 -0
  290. package/node_modules/form-data/CHANGELOG.md +686 -0
  291. package/node_modules/form-data/License +19 -0
  292. package/node_modules/form-data/README.md +355 -0
  293. package/node_modules/form-data/index.d.ts +62 -0
  294. package/node_modules/form-data/lib/browser.js +4 -0
  295. package/node_modules/form-data/lib/form_data.js +506 -0
  296. package/node_modules/form-data/lib/populate.js +10 -0
  297. package/node_modules/form-data/package.json +82 -0
  298. package/node_modules/function-bind/.eslintrc +21 -0
  299. package/node_modules/function-bind/.github/FUNDING.yml +12 -0
  300. package/node_modules/function-bind/.github/SECURITY.md +3 -0
  301. package/node_modules/function-bind/.nycrc +13 -0
  302. package/node_modules/function-bind/CHANGELOG.md +136 -0
  303. package/node_modules/function-bind/LICENSE +20 -0
  304. package/node_modules/function-bind/README.md +46 -0
  305. package/node_modules/function-bind/implementation.js +84 -0
  306. package/node_modules/function-bind/index.js +5 -0
  307. package/node_modules/function-bind/package.json +87 -0
  308. package/node_modules/function-bind/test/.eslintrc +9 -0
  309. package/node_modules/function-bind/test/index.js +252 -0
  310. package/node_modules/get-intrinsic/.eslintrc +42 -0
  311. package/node_modules/get-intrinsic/.github/FUNDING.yml +12 -0
  312. package/node_modules/get-intrinsic/.nycrc +9 -0
  313. package/node_modules/get-intrinsic/CHANGELOG.md +186 -0
  314. package/node_modules/get-intrinsic/LICENSE +21 -0
  315. package/node_modules/get-intrinsic/README.md +71 -0
  316. package/node_modules/get-intrinsic/index.js +378 -0
  317. package/node_modules/get-intrinsic/package.json +97 -0
  318. package/node_modules/get-intrinsic/test/GetIntrinsic.js +274 -0
  319. package/node_modules/get-proto/.eslintrc +10 -0
  320. package/node_modules/get-proto/.github/FUNDING.yml +12 -0
  321. package/node_modules/get-proto/.nycrc +9 -0
  322. package/node_modules/get-proto/CHANGELOG.md +21 -0
  323. package/node_modules/get-proto/LICENSE +21 -0
  324. package/node_modules/get-proto/Object.getPrototypeOf.d.ts +5 -0
  325. package/node_modules/get-proto/Object.getPrototypeOf.js +6 -0
  326. package/node_modules/get-proto/README.md +50 -0
  327. package/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +3 -0
  328. package/node_modules/get-proto/Reflect.getPrototypeOf.js +4 -0
  329. package/node_modules/get-proto/index.d.ts +5 -0
  330. package/node_modules/get-proto/index.js +27 -0
  331. package/node_modules/get-proto/package.json +81 -0
  332. package/node_modules/get-proto/test/index.js +68 -0
  333. package/node_modules/get-proto/tsconfig.json +9 -0
  334. package/node_modules/gopd/.eslintrc +16 -0
  335. package/node_modules/gopd/.github/FUNDING.yml +12 -0
  336. package/node_modules/gopd/CHANGELOG.md +45 -0
  337. package/node_modules/gopd/LICENSE +21 -0
  338. package/node_modules/gopd/README.md +40 -0
  339. package/node_modules/gopd/gOPD.d.ts +1 -0
  340. package/node_modules/gopd/gOPD.js +4 -0
  341. package/node_modules/gopd/index.d.ts +5 -0
  342. package/node_modules/gopd/index.js +15 -0
  343. package/node_modules/gopd/package.json +77 -0
  344. package/node_modules/gopd/test/index.js +36 -0
  345. package/node_modules/gopd/tsconfig.json +9 -0
  346. package/node_modules/has-symbols/.eslintrc +11 -0
  347. package/node_modules/has-symbols/.github/FUNDING.yml +12 -0
  348. package/node_modules/has-symbols/.nycrc +9 -0
  349. package/node_modules/has-symbols/CHANGELOG.md +91 -0
  350. package/node_modules/has-symbols/LICENSE +21 -0
  351. package/node_modules/has-symbols/README.md +46 -0
  352. package/node_modules/has-symbols/index.d.ts +3 -0
  353. package/node_modules/has-symbols/index.js +14 -0
  354. package/node_modules/has-symbols/package.json +111 -0
  355. package/node_modules/has-symbols/shams.d.ts +3 -0
  356. package/node_modules/has-symbols/shams.js +45 -0
  357. package/node_modules/has-symbols/test/index.js +22 -0
  358. package/node_modules/has-symbols/test/shams/core-js.js +29 -0
  359. package/node_modules/has-symbols/test/shams/get-own-property-symbols.js +29 -0
  360. package/node_modules/has-symbols/test/tests.js +58 -0
  361. package/node_modules/has-symbols/tsconfig.json +10 -0
  362. package/node_modules/has-tostringtag/.eslintrc +5 -0
  363. package/node_modules/has-tostringtag/.github/FUNDING.yml +12 -0
  364. package/node_modules/has-tostringtag/.nycrc +13 -0
  365. package/node_modules/has-tostringtag/CHANGELOG.md +42 -0
  366. package/node_modules/has-tostringtag/LICENSE +21 -0
  367. package/node_modules/has-tostringtag/README.md +46 -0
  368. package/node_modules/has-tostringtag/index.d.ts +3 -0
  369. package/node_modules/has-tostringtag/index.js +8 -0
  370. package/node_modules/has-tostringtag/package.json +108 -0
  371. package/node_modules/has-tostringtag/shams.d.ts +3 -0
  372. package/node_modules/has-tostringtag/shams.js +8 -0
  373. package/node_modules/has-tostringtag/test/index.js +21 -0
  374. package/node_modules/has-tostringtag/test/shams/core-js.js +31 -0
  375. package/node_modules/has-tostringtag/test/shams/get-own-property-symbols.js +30 -0
  376. package/node_modules/has-tostringtag/test/tests.js +15 -0
  377. package/node_modules/has-tostringtag/tsconfig.json +49 -0
  378. package/node_modules/hasown/.github/FUNDING.yml +12 -0
  379. package/node_modules/hasown/.nycrc +13 -0
  380. package/node_modules/hasown/CHANGELOG.md +58 -0
  381. package/node_modules/hasown/LICENSE +21 -0
  382. package/node_modules/hasown/README.md +40 -0
  383. package/node_modules/hasown/eslint.config.mjs +6 -0
  384. package/node_modules/hasown/index.d.ts +3 -0
  385. package/node_modules/hasown/index.js +8 -0
  386. package/node_modules/hasown/package.json +91 -0
  387. package/node_modules/hasown/tsconfig.json +6 -0
  388. package/node_modules/math-intrinsics/.eslintrc +16 -0
  389. package/node_modules/math-intrinsics/.github/FUNDING.yml +12 -0
  390. package/node_modules/math-intrinsics/CHANGELOG.md +24 -0
  391. package/node_modules/math-intrinsics/LICENSE +21 -0
  392. package/node_modules/math-intrinsics/README.md +50 -0
  393. package/node_modules/math-intrinsics/abs.d.ts +1 -0
  394. package/node_modules/math-intrinsics/abs.js +4 -0
  395. package/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +3 -0
  396. package/node_modules/math-intrinsics/constants/maxArrayLength.js +4 -0
  397. package/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +3 -0
  398. package/node_modules/math-intrinsics/constants/maxSafeInteger.js +5 -0
  399. package/node_modules/math-intrinsics/constants/maxValue.d.ts +3 -0
  400. package/node_modules/math-intrinsics/constants/maxValue.js +5 -0
  401. package/node_modules/math-intrinsics/floor.d.ts +1 -0
  402. package/node_modules/math-intrinsics/floor.js +4 -0
  403. package/node_modules/math-intrinsics/isFinite.d.ts +3 -0
  404. package/node_modules/math-intrinsics/isFinite.js +12 -0
  405. package/node_modules/math-intrinsics/isInteger.d.ts +3 -0
  406. package/node_modules/math-intrinsics/isInteger.js +16 -0
  407. package/node_modules/math-intrinsics/isNaN.d.ts +1 -0
  408. package/node_modules/math-intrinsics/isNaN.js +6 -0
  409. package/node_modules/math-intrinsics/isNegativeZero.d.ts +3 -0
  410. package/node_modules/math-intrinsics/isNegativeZero.js +6 -0
  411. package/node_modules/math-intrinsics/max.d.ts +1 -0
  412. package/node_modules/math-intrinsics/max.js +4 -0
  413. package/node_modules/math-intrinsics/min.d.ts +1 -0
  414. package/node_modules/math-intrinsics/min.js +4 -0
  415. package/node_modules/math-intrinsics/mod.d.ts +3 -0
  416. package/node_modules/math-intrinsics/mod.js +9 -0
  417. package/node_modules/math-intrinsics/package.json +86 -0
  418. package/node_modules/math-intrinsics/pow.d.ts +1 -0
  419. package/node_modules/math-intrinsics/pow.js +4 -0
  420. package/node_modules/math-intrinsics/round.d.ts +1 -0
  421. package/node_modules/math-intrinsics/round.js +4 -0
  422. package/node_modules/math-intrinsics/sign.d.ts +3 -0
  423. package/node_modules/math-intrinsics/sign.js +11 -0
  424. package/node_modules/math-intrinsics/test/index.js +192 -0
  425. package/node_modules/math-intrinsics/tsconfig.json +3 -0
  426. package/node_modules/mime-db/HISTORY.md +507 -0
  427. package/node_modules/mime-db/LICENSE +23 -0
  428. package/node_modules/mime-db/README.md +100 -0
  429. package/node_modules/mime-db/db.json +8519 -0
  430. package/node_modules/mime-db/index.js +12 -0
  431. package/node_modules/mime-db/package.json +60 -0
  432. package/node_modules/mime-types/HISTORY.md +397 -0
  433. package/node_modules/mime-types/LICENSE +23 -0
  434. package/node_modules/mime-types/README.md +113 -0
  435. package/node_modules/mime-types/index.js +188 -0
  436. package/node_modules/mime-types/package.json +44 -0
  437. package/node_modules/proxy-from-env/LICENSE +20 -0
  438. package/node_modules/proxy-from-env/README.md +163 -0
  439. package/node_modules/proxy-from-env/index.cjs +105 -0
  440. package/node_modules/proxy-from-env/index.js +103 -0
  441. package/node_modules/proxy-from-env/package.json +43 -0
  442. package/package.json +2 -1
  443. package/dist/web/assets/Assistant-DSQAdSiW.js +0 -1
  444. package/dist/web/assets/index-BXpTaAUz.js +0 -66
@@ -0,0 +1,2786 @@
1
+ > [!IMPORTANT]
2
+ > [**Get Security Updates for Axios v0 →**](https://www.herodevs.com/support/nes-for-axios?utm_source=axios-site&utm_medium=referral&utm_campaign=nes-for-axios_global&utm_content=landing-page_none_20260924_a)
3
+
4
+ <h3 align="center">💎 Platinum sponsors <br /></h3>
5
+ <table align="center">
6
+ <tr>
7
+ <td align="center" width="50%">
8
+ <a
9
+ href="https://thanks.dev/?utm_source&#x3D;axios&amp;utm_medium&#x3D;sponsorlist&amp;utm_campaign&#x3D;sponsorship"
10
+ style="padding: 10px; display: inline-block"
11
+ target="_blank"
12
+ >
13
+ <img
14
+ width="90px"
15
+ height="90px"
16
+ src="https://images.opencollective.com/thanks-dev/360b917/logo/256.png?height=256"
17
+ alt="Thanks.dev"
18
+ />
19
+ </a>
20
+ <p
21
+ align="center"
22
+ >
23
+ We're passionate about making open source sustainable. Scan your dependency tree to better understand which open source projects need funding.
24
+ </p>
25
+ <p align="center">
26
+ <a
27
+ href="https://thanks.dev/?utm_source&#x3D;axios&amp;utm_medium&#x3D;readme_sponsorlist&amp;utm_campaign&#x3D;sponsorship"
28
+ target="_blank"
29
+ ><b>thanks.dev</b></a
30
+ >
31
+ </p>
32
+ </td>
33
+ <td align="center" width="50%">
34
+ <a
35
+ href="https://opencollective.com/axios/contribute"
36
+ target="_blank"
37
+ >💜 Become a sponsor</a
38
+ >
39
+ </td>
40
+ </tr>
41
+ </table>
42
+ <table align="center">
43
+ <tr>
44
+ <td align="center" width="50%">
45
+ <a
46
+ href="https://opencollective.com/axios/contribute"
47
+ target="_blank"
48
+ >💜 Become a sponsor</a
49
+ >
50
+ </td>
51
+ <td align="center" width="50%">
52
+ <a
53
+ href="https://opencollective.com/axios/contribute"
54
+ target="_blank"
55
+ >💜 Become a sponsor</a
56
+ >
57
+ </td>
58
+ </tr>
59
+ </table>
60
+ <h3 align="center">🥇 Gold sponsors <br /></h3>
61
+ <table align="center" width="100%">
62
+ <tr width="33.333333333333336%">
63
+ <td align="center" width="33.333333333333336%">
64
+ <a
65
+ href="https://www.principal.com/about-us?utm_source&#x3D;axios&amp;utm_medium&#x3D;sponsorlist&amp;utm_campaign&#x3D;sponsorship"
66
+ style="padding: 10px; display: inline-block"
67
+ target="_blank"
68
+ >
69
+ <img
70
+ width="90px"
71
+ height="90px"
72
+ src="https://images.opencollective.com/principal/431e690/logo.png"
73
+ alt="Principal Financial Group"
74
+ />
75
+ </a>
76
+ <p
77
+ align="center"
78
+ >
79
+ Free tools to help with your financial planning needs!
80
+ </p>
81
+ <p align="center">
82
+ <a
83
+ href="https://www.principal.com/about-us?utm_source&#x3D;axios&amp;utm_medium&#x3D;readme_sponsorlist&amp;utm_campaign&#x3D;sponsorship"
84
+ target="_blank"
85
+ ><b>principal.com</b></a
86
+ >
87
+ </p>
88
+ </td>
89
+ <td align="center" width="33.333333333333336%">
90
+ <a
91
+ href="https://opensource.sap.com?utm_source&#x3D;axios&amp;utm_medium&#x3D;sponsorlist&amp;utm_campaign&#x3D;sponsorship"
92
+ style="padding: 10px; display: inline-block"
93
+ target="_blank"
94
+ >
95
+ <img
96
+ width="90px"
97
+ height="90px"
98
+ src="https://avatars.githubusercontent.com/u/2531208?s=200&v=4"
99
+ alt="SAP"
100
+ />
101
+ </a>
102
+ <p
103
+ align="center"
104
+ title="SAP SE, a global software company, is one of the largest vendors of ERP and other enterprise applications."
105
+ >
106
+ BSAP SE, a global software company, is one of the largest vendors of ERP and other enterprise applications.
107
+ </p>
108
+ <p align="center">
109
+ <a
110
+ href="https://opensource.sap.com?utm_source&#x3D;axios&amp;utm_medium&#x3D;readme_sponsorlist&amp;utm_campaign&#x3D;sponsorship"
111
+ target="_blank"
112
+ ><b>opensource.sap.com</b></a
113
+ >
114
+ </p>
115
+ </td>
116
+ <td align="center" width="33.333333333333336%">
117
+ <a
118
+ href="https://www.descope.com/?utm_source&#x3D;axios&amp;utm_medium&#x3D;referral&amp;utm_campaign&#x3D;axios-oss-sponsorship"
119
+ style="padding: 10px; display: inline-block"
120
+ target="_blank"
121
+ >
122
+ <img
123
+ width="90px"
124
+ height="90px"
125
+ src="https://images.opencollective.com/descope/b53243e/logo.png"
126
+ alt="Descope"
127
+ />
128
+ </a>
129
+ <p
130
+ align="center"
131
+ title="Hi, we&#x27;re Descope! We are building something in the authentication space for app developers and can't wait to place it in your hands."
132
+ >
133
+ Reduce user friction, prevent account takeover, and get a 360° view of your customer and agentic identities with the Descope External IAM platform.
134
+ </p>
135
+ <p align="center">
136
+ <a
137
+ href="https://www.descope.com/?utm_source&#x3D;axios&amp;utm_medium&#x3D;referral&amp;utm_campaign&#x3D;axios-oss-sponsorship"
138
+ target="_blank"
139
+ ><b>descope.com</b></a
140
+ >
141
+ </p>
142
+ </td>
143
+ </tr>
144
+ <tr width="33.333333333333336%">
145
+ <td align="center" width="33.333333333333336%">
146
+ <a
147
+ href="https://rxdb.info/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship&utm_content=logo"
148
+ style="padding: 10px; display: inline-block"
149
+ target="_blank"
150
+ >
151
+ <img
152
+ width="90px"
153
+ height="90px"
154
+ src="https://rxdb.info/files/logo/logo_text_white.svg"
155
+ alt="RxDB"
156
+ />
157
+ </a>
158
+ <p
159
+ align="center"
160
+ >
161
+ RxDB is a NoSQL database for JavaScript that runs directly in your app.
162
+ </p>
163
+ <p align="center">
164
+ <a
165
+ href="https://rxdb.info/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship&utm_content=logo"
166
+ target="_blank"
167
+ ><b>rxdb.info</b></a
168
+ >
169
+ </p>
170
+ </td>
171
+ <td align="center" width="33.333333333333336%">
172
+ <a
173
+ href="https://poprey.com/?utm_source&#x3D;axios&amp;utm_medium&#x3D;sponsorlist&amp;utm_campaign&#x3D;sponsorship"
174
+ style="padding: 10px; display: inline-block"
175
+ target="_blank"
176
+ >
177
+ <img
178
+ width="70px"
179
+ height="70px"
180
+ src="https://images.opencollective.com/instagram-likes/2a72a03/avatar.png"
181
+ alt="Poprey"
182
+ />
183
+ </a>
184
+ <p align="center">
185
+ Buy Instagram Likes
186
+ </p>
187
+ <p align="center">
188
+ <a
189
+ href="https://poprey.com/?utm_source&#x3D;axios&amp;utm_medium&#x3D;readme_sponsorlist&amp;utm_campaign&#x3D;sponsorship"
190
+ target="_blank"
191
+ ><b>poprey.com</b></a
192
+ >
193
+ </p>
194
+ </td>
195
+ <td align="center" width="33.333333333333336%">
196
+ <a
197
+ href="https://global.fun88.com/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
198
+ style="padding: 10px; display: inline-block"
199
+ target="_blank"
200
+ >
201
+ <img
202
+ width="71px"
203
+ height="70px"
204
+ src="https://images.opencollective.com/fun88-official/bf2843c/logo.png"
205
+ alt="Fun 88"
206
+ />
207
+ </a>
208
+ <p
209
+ align="center"
210
+ >
211
+ 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.
212
+ </p>
213
+ <p align="center">
214
+ <a
215
+ href="https://global.fun88.com/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
216
+ target="_blank"
217
+ ><b>global.fun88.com</b></a
218
+ >
219
+ </p>
220
+ </td>
221
+ </tr>
222
+ <tr width="33.333333333333336%">
223
+ <td align="center" width="33.333333333333336%">
224
+ <a
225
+ href="https://www.jbo88b.com/vn/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
226
+ style="padding: 10px; display: inline-block"
227
+ target="_blank"
228
+ >
229
+ <img
230
+ width="71px"
231
+ height="70px"
232
+ src="https://images.opencollective.com/jbo-vietnam/3fc6159/avatar.png"
233
+ alt="JBO Vietnam"
234
+ />
235
+ </a>
236
+ <p
237
+ align="center"
238
+ >
239
+ JBO Vietnam is a prominent online entertainment brand in Vietnam, offering sports betting, esports, online casino games, and a wide range of other exciting games.
240
+ </p>
241
+ <p align="center">
242
+ <a
243
+ href="https://www.jbo88b.com/vn/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
244
+ target="_blank"
245
+ ><b>jbo88b.com</b></a
246
+ >
247
+ </p>
248
+ </td>
249
+ <td align="center" width="33.333333333333336%">
250
+ <a
251
+ href="https://www.jbo579.com/th/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
252
+ style="padding: 10px; display: inline-block"
253
+ target="_blank"
254
+ >
255
+ <img
256
+ width="71px"
257
+ height="70px"
258
+ src="https://images.opencollective.com/jbo-thailand/d17e84f/avatar.png"
259
+ alt="JBO Thailand"
260
+ />
261
+ </a>
262
+ <p
263
+ align="center"
264
+ >
265
+ JBO Thailand is a prominent online entertainment brand in Thailand, offering sports betting, esports, online casino games, and a wide range of other exciting games.
266
+ </p>
267
+ <p align="center">
268
+ <a
269
+ href="https://www.jbo579.com/th/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
270
+ target="_blank"
271
+ ><b>jbo88b.com</b></a
272
+ >
273
+ </p>
274
+ </td>
275
+ <td align="center" width="33.333333333333336%">
276
+ <a
277
+ href="https://www.scrapingbee.com/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
278
+ style="padding: 10px; display: inline-block"
279
+ target="_blank"
280
+ >
281
+ <img
282
+ width="90px"
283
+ height="90px"
284
+ src="https://images.opencollective.com/scrapingbee/6d5dc95/logo.png"
285
+ alt="ScrapingBee"
286
+ />
287
+ </a>
288
+ <p
289
+ align="center"
290
+ >
291
+ Scrape websites with a powerful web scraping API without managing proxies, browsers, or anti-bot defenses.
292
+ </p>
293
+ <p align="center">
294
+ <a
295
+ href="https://www.scrapingbee.com/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
296
+ target="_blank"
297
+ ><b>scrapingbee.com</b></a
298
+ >
299
+ </p>
300
+ </td>
301
+ </tr>
302
+ <tr width="33.333333333333336%">
303
+ <td align="center" width="33.333333333333336%">
304
+ <a
305
+ href="https://www.herodevs.com/support/nes-for-axios?utm_source=axios-site&amp;utm_medium=referral&amp;utm_campaign=nes-for-axios_global&amp;utm_content=landing-page_none_20260924_a"
306
+ style="padding: 10px; display: inline-block"
307
+ target="_blank"
308
+ >
309
+ <img
310
+ width="180px"
311
+ height="53px"
312
+ src="https://axios.rest/sponsors/herodevs.svg"
313
+ alt="HeroDevs"
314
+ />
315
+ </a>
316
+ <p
317
+ align="center"
318
+ >
319
+ Security and long-term support for end-of-life open source software.
320
+ </p>
321
+ <p align="center">
322
+ <a
323
+ href="https://www.herodevs.com/support/nes-for-axios?utm_source=axios-site&amp;utm_medium=referral&amp;utm_campaign=nes-for-axios_global&amp;utm_content=landing-page_none_20260924_a"
324
+ target="_blank"
325
+ ><b>herodevs.com</b></a
326
+ >
327
+ </p>
328
+ </td>
329
+ <td align="center" width="33.333333333333336%">
330
+ <a
331
+ href="https://opencollective.com/sweepico-promo-code"
332
+ style="padding: 10px; display: inline-block"
333
+ target="_blank"
334
+ >
335
+ <img
336
+ width="90px"
337
+ height="90px"
338
+ src="https://images.opencollective.com/sweepico-promo-code/4dd517a/logo.png"
339
+ alt="Sweepico Promo Code"
340
+ />
341
+ </a>
342
+ <p
343
+ align="center"
344
+ >
345
+ Social Gaming Platform
346
+ </p>
347
+ <p align="center">
348
+ <a
349
+ href="https://opencollective.com/sweepico-promo-code"
350
+ target="_blank"
351
+ ><b>Sweepico Promo Code</b></a
352
+ >
353
+ </p>
354
+ </td>
355
+ </tr>
356
+ </table>
357
+
358
+ <!--<div>marker</div>-->
359
+
360
+ <br><br>
361
+
362
+ <div align="center">
363
+ <a href="https://axios.rest"><img src="https://axios.rest/logo.svg" alt="Axios" /></a><br>
364
+ </div>
365
+
366
+ <p align="center">Promise based HTTP client for the browser and node.js</p>
367
+
368
+ <p align="center">
369
+ <a href="https://axios.rest/"><b>Website</b></a> •
370
+ <a href="https://axios.rest/pages/getting-started/first-steps.html"><b>Documentation</b></a>
371
+ </p>
372
+
373
+ <div align="center">
374
+
375
+ [![npm version](https://img.shields.io/npm/v/axios.svg?style=flat-square)](https://www.npmjs.org/package/axios)
376
+ [![Build status](https://img.shields.io/github/actions/workflow/status/axios/axios/ci.yml?branch=v1.x&label=CI&logo=github&style=flat-square)](https://github.com/axios/axios/actions/workflows/ci.yml)
377
+ [![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod&style=flat-square)](https://gitpod.io/#https://github.com/axios/axios)
378
+ [![install size](https://img.shields.io/badge/dynamic/json?url=https://packagephobia.com/v2/api.json?p=axios&query=$.install.pretty&label=install%20size&style=flat-square)](https://packagephobia.now.sh/result?p=axios)
379
+ [![npm bundle size](https://img.shields.io/bundlephobia/minzip/axios?style=flat-square)](https://bundlephobia.com/package/axios@latest)
380
+ [![npm downloads](https://img.shields.io/npm/dm/axios.svg?style=flat-square)](https://npm-stat.com/charts.html?package=axios)
381
+ [![gitter chat](https://img.shields.io/gitter/room/mzabriskie/axios.svg?style=flat-square)](https://gitter.im/mzabriskie/axios)
382
+ [![code helpers](https://www.codetriage.com/axios/axios/badges/users.svg)](https://www.codetriage.com/axios/axios)
383
+ [![Contributors](https://img.shields.io/github/contributors/axios/axios.svg?style=flat-square)](CONTRIBUTORS.md)
384
+ [![Agent Friendly](https://agentfriendlycode.com/api/badge/github/axios/axios.svg)](https://agentfriendlycode.com/repo/32)
385
+
386
+ </div>
387
+
388
+ ## Table of contents
389
+
390
+ - [Features](#features)
391
+ - [Browser support](#browser-support)
392
+ - [Installing](#installing)
393
+ - [Package manager](#package-manager)
394
+ - [CDN](#cdn)
395
+ - [Example](#example)
396
+ - [Axios API](#axios-api)
397
+ - [Request method aliases](#request-method-aliases)
398
+ - [Concurrency](#concurrency-deprecated)
399
+ - [Creating an instance](#creating-an-instance)
400
+ - [Instance methods](#instance-methods)
401
+ - [Request config](#request-config)
402
+ - [Response schema](#response-schema)
403
+ - [Config defaults](#config-defaults)
404
+ - [Global axios defaults](#global-axios-defaults)
405
+ - [Custom instance defaults](#custom-instance-defaults)
406
+ - [Config order of precedence](#config-order-of-precedence)
407
+ - [Interceptors](#interceptors)
408
+ - [Multiple interceptors](#multiple-interceptors)
409
+ - [Handling errors](#handling-errors)
410
+ - [Handling timeouts](#handling-timeouts)
411
+ - [Cancellation](#cancellation)
412
+ - [AbortController](#abortcontroller)
413
+ - [CancelToken](#canceltoken-deprecated)
414
+ - [Using application/x-www-form-urlencoded format](#using-applicationx-www-form-urlencoded-format)
415
+ - [URLSearchParams](#urlsearchparams)
416
+ - [Query string](#query-string-older-browsers)
417
+ - [Automatic serialization](#automatic-serialization-to-urlsearchparams)
418
+ - [Using multipart/form-data format](#using-multipartform-data-format)
419
+ - [FormData](#formdata)
420
+ - [Automatic serialization](#automatic-serialization-to-formdata)
421
+ - [Posting files](#posting-files)
422
+ - [HTML form posting](#html-form-posting-browser)
423
+ - [Progress capturing](#progress-capturing)
424
+ - [Rate limiting](#rate-limiting)
425
+ - [AxiosHeaders](#axiosheaders)
426
+ - [Fetch adapter](#fetch-adapter)
427
+ - [Custom fetch](#custom-fetch)
428
+ - [Using with Tauri](#using-with-tauri)
429
+ - [Using with SvelteKit](#using-with-sveltekit)
430
+ - [HTTP/2 support](#http2-support)
431
+ - [Semver](#semver)
432
+ - [Promises](#promises)
433
+ - [TypeScript](#typescript)
434
+ - [Contributing](#contributing)
435
+ - [Local setup](#local-setup)
436
+ - [Resources](#resources)
437
+ - [Credits](#credits)
438
+ - [License](#license)
439
+
440
+ ## Features
441
+
442
+ - Make [XMLHttpRequests](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) from the browser.
443
+ - Make [http](https://nodejs.org/api/http.html) requests from Node.js.
444
+ - Use the [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) API for asynchronous request handling.
445
+ - Intercept requests and responses to add custom logic or transform data.
446
+ - Transform request and response data.
447
+ - Cancel requests with built-in cancellation APIs.
448
+ - Serialize and parse [JSON](https://www.json.org/json-en.html) data.
449
+ - Serialize data objects to `multipart/form-data` or `application/x-www-form-urlencoded`.
450
+ - Add client-side protection against [Cross-Site Request Forgery](https://en.wikipedia.org/wiki/Cross-site_request_forgery).
451
+
452
+ ## Browser support
453
+
454
+ | Chrome | Firefox | Safari | Opera | Edge |
455
+ | :------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------: |
456
+ | ![Chrome browser logo](https://raw.githubusercontent.com/alrra/browser-logos/main/src/chrome/chrome_48x48.png) | ![Firefox browser logo](https://raw.githubusercontent.com/alrra/browser-logos/main/src/firefox/firefox_48x48.png) | ![Safari browser logo](https://raw.githubusercontent.com/alrra/browser-logos/main/src/safari/safari_48x48.png) | ![Opera browser logo](https://raw.githubusercontent.com/alrra/browser-logos/main/src/opera/opera_48x48.png) | ![Edge browser logo](https://raw.githubusercontent.com/alrra/browser-logos/main/src/edge/edge_48x48.png) |
457
+ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ |
458
+
459
+ [![Browser Matrix](https://saucelabs.com/open_sauce/build_matrix/axios.svg)](https://saucelabs.com/u/axios)
460
+
461
+ ## Installing
462
+
463
+ ### Package manager
464
+
465
+ Using npm:
466
+
467
+ ```bash
468
+ $ npm install axios
469
+ ```
470
+
471
+ Using yarn:
472
+
473
+ ```bash
474
+ $ yarn add axios
475
+ ```
476
+
477
+ Using pnpm:
478
+
479
+ ```bash
480
+ $ pnpm add axios
481
+ ```
482
+
483
+ Using bun:
484
+
485
+ ```bash
486
+ $ bun add axios
487
+ ```
488
+
489
+ Using Deno:
490
+
491
+ ```bash
492
+ $ deno add axios
493
+ ```
494
+
495
+ Once the package is installed, import it with `import` or `require`:
496
+
497
+ ```js
498
+ import axios, { isCancel, AxiosError } from 'axios';
499
+ ```
500
+
501
+ You can also use the default export, since the named export is just a re-export from the Axios factory:
502
+
503
+ ```js
504
+ import axios from 'axios';
505
+
506
+ console.log(axios.isCancel('something'));
507
+ ```
508
+
509
+ If you use `require` for importing, **only the default export is available**:
510
+
511
+ ```js
512
+ const axios = require('axios');
513
+
514
+ console.log(axios.isCancel('something'));
515
+ ```
516
+
517
+ Some bundlers and ES6 linters need this form:
518
+
519
+ ```js
520
+ import { default as axios } from 'axios';
521
+ ```
522
+
523
+ In custom or legacy environments, you can import the bundle directly:
524
+
525
+ ```js
526
+ const axios = require('axios/dist/browser/axios.cjs'); // browser commonJS bundle (ES2017)
527
+ // const axios = require('axios/dist/node/axios.cjs'); // node commonJS bundle (ES2017)
528
+ ```
529
+
530
+ ### CDN
531
+
532
+ Using jsDelivr CDN (ES5 UMD browser module):
533
+
534
+ ```html
535
+ <script src="https://cdn.jsdelivr.net/npm/axios@1.20.0/dist/axios.min.js"></script>
536
+ ```
537
+
538
+ Using unpkg CDN:
539
+
540
+ ```html
541
+ <script src="https://unpkg.com/axios@1.20.0/dist/axios.min.js"></script>
542
+ ```
543
+
544
+ ## Example
545
+
546
+ ```js
547
+ import axios from 'axios';
548
+ //const axios = require('axios'); // legacy way
549
+
550
+ try {
551
+ const response = await axios.get('/user?ID=12345');
552
+ console.log(response);
553
+ } catch (error) {
554
+ console.error(error);
555
+ }
556
+
557
+ // Optionally the request above could also be done as
558
+ axios
559
+ .get('/user', {
560
+ params: {
561
+ ID: 12345,
562
+ },
563
+ timeout: 5000, // 5 seconds. See "Handling Timeouts" below for matching error handling
564
+ })
565
+ .then(function (response) {
566
+ console.log(response);
567
+ })
568
+ .catch(function (error) {
569
+ console.log(error);
570
+ })
571
+ .finally(function () {
572
+ // always executed
573
+ });
574
+
575
+ // Want to use async/await? Add the `async` keyword to your outer function/method.
576
+ async function getUser() {
577
+ try {
578
+ // Example: GET request with query parameters
579
+ const response = await axios.get('/user', {
580
+ params: {
581
+ ID: 12345,
582
+ },
583
+ });
584
+
585
+ // Using the `params` option improves readability and automatically formats query strings
586
+
587
+ console.log(response);
588
+ } catch (error) {
589
+ console.error(error);
590
+ }
591
+ }
592
+ ```
593
+
594
+ > Note: Set a `timeout` in production. Without one, a stalled request can hang
595
+ > indefinitely. See [Handling Timeouts](#handling-timeouts) for the matching error handling.
596
+
597
+ > Note: `async/await` is part of ECMAScript 2017 and is not supported in Internet
598
+ > Explorer and older browsers, so use with caution.
599
+
600
+ Performing a `POST` request
601
+
602
+ ```js
603
+ const response = await axios.post('/user', {
604
+ firstName: 'Fred',
605
+ lastName: 'Flintstone',
606
+ });
607
+ console.log(response);
608
+ ```
609
+
610
+ Performing multiple concurrent requests
611
+
612
+ ```js
613
+ function getUserAccount() {
614
+ return axios.get('/user/12345');
615
+ }
616
+
617
+ function getUserPermissions() {
618
+ return axios.get('/user/12345/permissions');
619
+ }
620
+
621
+ Promise.all([getUserAccount(), getUserPermissions()]).then(function (results) {
622
+ const acct = results[0];
623
+ const perm = results[1];
624
+ });
625
+ ```
626
+
627
+ ## axios API
628
+
629
+ Requests can be made by passing the relevant config to `axios`.
630
+
631
+ ##### axios(config)
632
+
633
+ ```js
634
+ // Send a POST request
635
+ axios({
636
+ method: 'post',
637
+ url: '/user/12345',
638
+ data: {
639
+ firstName: 'Fred',
640
+ lastName: 'Flintstone',
641
+ },
642
+ });
643
+ ```
644
+
645
+ ```js
646
+ // GET request for remote image in node.js
647
+ import fs from 'fs';
648
+ const response = await axios({
649
+ method: 'get',
650
+ url: 'https://bit.ly/2mTM3nY',
651
+ responseType: 'stream',
652
+ });
653
+ response.data.pipe(fs.createWriteStream('ada_lovelace.jpg'));
654
+ ```
655
+
656
+ ##### axios(url[, config])
657
+
658
+ ```js
659
+ // Send a GET request (default method)
660
+ axios('/user/12345');
661
+ ```
662
+
663
+ ### Request method aliases
664
+
665
+ For convenience, aliases have been provided for all common request methods.
666
+
667
+ ##### axios.request(config)
668
+
669
+ ##### axios.get(url[, config])
670
+
671
+ ##### axios.delete(url[, config])
672
+
673
+ ##### axios.head(url[, config])
674
+
675
+ ##### axios.options(url[, config])
676
+
677
+ ##### axios.post(url[, data[, config]])
678
+
679
+ ##### axios.put(url[, data[, config]])
680
+
681
+ ##### axios.patch(url[, data[, config]])
682
+
683
+ ###### Note
684
+
685
+ When using the alias methods `url`, `method`, and `data` properties don't need to be specified in config.
686
+
687
+ ### Concurrency (deprecated)
688
+
689
+ Use `Promise.all` instead of these helpers.
690
+
691
+ Helper functions for dealing with concurrent requests.
692
+
693
+ axios.all(iterable)
694
+ axios.spread(callback)
695
+
696
+ ### Creating an instance
697
+
698
+ You can create a new instance of axios with a custom config.
699
+
700
+ ##### axios.create([config])
701
+
702
+ ```js
703
+ const instance = axios.create({
704
+ baseURL: 'https://some-domain.com/api/',
705
+ timeout: 1000,
706
+ headers: { 'X-Custom-Header': 'foobar' },
707
+ });
708
+ ```
709
+
710
+ ### Instance methods
711
+
712
+ The following instance methods are available. Axios merges the specified config with the instance config.
713
+
714
+ ##### axios#request(config)
715
+
716
+ ##### axios#get(url[, config])
717
+
718
+ ##### axios#delete(url[, config])
719
+
720
+ ##### axios#head(url[, config])
721
+
722
+ ##### axios#options(url[, config])
723
+
724
+ ##### axios#post(url[, data[, config]])
725
+
726
+ ##### axios#put(url[, data[, config]])
727
+
728
+ ##### axios#patch(url[, data[, config]])
729
+
730
+ ##### axios#getUri([config])
731
+
732
+ ## Request config
733
+
734
+ ### Security notice: decompression-bomb protection is opt-in
735
+
736
+ 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.
737
+
738
+ If you call servers you do not fully trust, **set a cap**:
739
+
740
+ ```js
741
+ axios.defaults.maxContentLength = 10 * 1024 * 1024; // 10 MB
742
+ axios.defaults.maxBodyLength = 10 * 1024 * 1024;
743
+ ```
744
+
745
+ See the [security guide](https://axios.rest/pages/misc/security.html) for details.
746
+
747
+ These config options are available for requests. Only `url` is required. Requests default to `GET` when `method` is not set.
748
+
749
+ ```js
750
+ {
751
+ // `url` is the server URL for the request
752
+ url: '/user',
753
+
754
+ // `method` is the request method to be used when making the request
755
+ method: 'get', // default
756
+
757
+ // Axios prepends `baseURL` to `url` unless `url` is absolute and `allowAbsoluteUrls` is set to true.
758
+ // It can be convenient to set `baseURL` for an instance of axios to pass relative URLs
759
+ // to the methods of that instance.
760
+ // `baseURL` is not a security boundary. If `url` is attacker-controlled, validate it
761
+ // before passing it to axios. Relative URLs can contain `..` segments that resolve
762
+ // outside an intended path prefix after the final URL is parsed.
763
+ // HTTP(S) URLs must include `//` after the protocol. Values such as
764
+ // `https:example.com` and `https:/example.com` are rejected with ERR_INVALID_URL.
765
+ baseURL: 'https://some-domain.com/api/',
766
+
767
+ // `allowAbsoluteUrls` determines whether or not absolute URLs will override a configured `baseUrl`.
768
+ // When set to true (default), absolute values for `url` will override `baseUrl`.
769
+ // When set to false, absolute values for `url` will always be prepended by `baseUrl`.
770
+ allowAbsoluteUrls: true,
771
+
772
+ // `transformRequest` allows changes to the request data before it is sent to the server
773
+ // This is only applicable for request methods 'PUT', 'POST', 'PATCH' and 'DELETE'
774
+ // The last function in the array must return a string or an instance of Buffer, ArrayBuffer,
775
+ // FormData or Stream
776
+ // You may modify the headers object.
777
+ transformRequest: [function (data, headers) {
778
+ // Do whatever you want to transform the data
779
+
780
+ return data;
781
+ }],
782
+
783
+ // `transformResponse` allows changes to the response data to be made before
784
+ // it is passed to then/catch
785
+ transformResponse: [function (data) {
786
+ // Do whatever you want to transform the data
787
+
788
+ return data;
789
+ }],
790
+
791
+ // `parseReviver` is an optional function passed as the
792
+ // second argument (reviver) to JSON.parse()
793
+ parseReviver: function (key, value, context) {
794
+ // In modern environments, context.source provides the raw JSON string
795
+ // allowing for precision-safe parsing of BigInt
796
+ if (typeof value === 'number' && context?.source) {
797
+ const isInteger = Number.isInteger(value);
798
+ const isUnsafe = !Number.isSafeInteger(value);
799
+ const isValidIntegerString = /^-?\d+$/.test(context.source);
800
+
801
+ if (isInteger && isUnsafe && isValidIntegerString) {
802
+ try {
803
+ return BigInt(context.source);
804
+ } catch {
805
+ // Fallback: return original value if parsing fails
806
+ }
807
+ }
808
+ }
809
+ return value;
810
+ },
811
+
812
+ // `headers` are custom headers to be sent
813
+ headers: {'X-Requested-With': 'XMLHttpRequest'},
814
+
815
+ // `params` are the URL parameters to be sent with the request
816
+ // Must be a plain object or a URLSearchParams object
817
+ params: {
818
+ ID: 12345
819
+ },
820
+
821
+ // `paramsSerializer` is an optional config that allows you to customize serializing `params`.
822
+ paramsSerializer: {
823
+
824
+ // Custom encoder function which sends key/value pairs in an iterative fashion.
825
+ encode?: (param: string): string => { /* Do custom operations here and return transformed string */ },
826
+
827
+ // Custom serializer function for the entire parameter. Allows the user to mimic pre 1.x behaviour.
828
+ serialize?: (params: Record<string, any>, options?: ParamsSerializerOptions ),
829
+
830
+ // Configuration for formatting array indexes in the params.
831
+ indexes: false, // Three available options: (1) indexes: null (leads to no brackets), (2) (default) indexes: false (leads to empty brackets), (3) indexes: true (leads to brackets with indexes).
832
+
833
+ // Maximum object nesting depth when serializing params. Payloads deeper than this throw an
834
+ // AxiosError with code ERR_FORM_DATA_DEPTH_EXCEEDED. Default: 100. Set to Infinity to disable.
835
+ maxDepth: 100
836
+
837
+ },
838
+
839
+ // `data` is the data to be sent as the request body
840
+ // Only applicable for request methods 'PUT', 'POST', 'DELETE', and 'PATCH'
841
+ // `data` is request-specific: axios does not inherit or deep-merge it from defaults.
842
+ // To add shared body fields, use a request interceptor or transformRequest.
843
+ // When no `transformRequest` is set, it must be of one of the following types:
844
+ // - string, plain object, ArrayBuffer, ArrayBufferView, URLSearchParams
845
+ // - Browser only: FormData, File, Blob
846
+ // - React Native: FormData
847
+ // - Node only: Stream, Buffer, FormData (form-data package)
848
+ data: {
849
+ firstName: 'Fred'
850
+ },
851
+
852
+ // `formDataHeaderPolicy` controls how node.js FormData#getHeaders() is copied.
853
+ // 'legacy' (default) copies all returned headers for v1 compatibility.
854
+ // 'content-only' copies only Content-Type and Content-Length.
855
+ formDataHeaderPolicy: 'legacy',
856
+
857
+ // syntax alternative to send data into the body
858
+ // method post
859
+ // only the value is sent, not the key
860
+ data: 'Country=Brasil&City=Belo Horizonte',
861
+
862
+ // `timeout` specifies the number of milliseconds before the request times out.
863
+ // If the request takes longer than `timeout`, Axios aborts it.
864
+ timeout: 1000, // default is `0` (no timeout)
865
+
866
+ // `withCredentials` indicates whether or not cross-site Access-Control requests
867
+ // should be made using credentials
868
+ // This only controls whether the browser sends credentials.
869
+ // It does not control whether the XSRF header is added.
870
+ withCredentials: false, // default
871
+
872
+ // `adapter` allows custom handling of requests which makes testing easier.
873
+ // Return a promise and supply a valid response (see lib/adapters/README.md)
874
+ adapter: function (config) {
875
+ /* ... */
876
+ },
877
+ // Also, you can set the name of the built-in adapter, or provide an array with their names
878
+ // to choose the first available in the environment
879
+ adapter: 'xhr', // 'fetch' | 'http' | ['xhr', 'http', 'fetch']
880
+
881
+ // `auth` indicates that HTTP Basic auth should be used, and supplies credentials.
882
+ // This will set an `Authorization` header, overwriting any existing
883
+ // `Authorization` custom headers you have set using `headers`.
884
+ // If `auth` is omitted, the Node.js HTTP and fetch adapters can read
885
+ // HTTP Basic auth credentials from the request URL, for example
886
+ // `https://user:pass@example.com`. Axios decodes percent-encoded URL
887
+ // credentials, and `auth` takes precedence over URL-embedded credentials.
888
+ // The Node.js HTTP adapter preserves Basic auth on same-origin redirects
889
+ // and strips it on cross-origin redirects.
890
+ // Please note that only HTTP Basic auth is configurable through this parameter.
891
+ // For Bearer tokens and such, use `Authorization` custom headers instead.
892
+ auth: {
893
+ username: 'janedoe',
894
+ password: 's00pers3cret'
895
+ },
896
+
897
+ // `responseType` indicates the type of data that the server will respond with
898
+ // options are: 'arraybuffer', 'document', 'json', 'text', 'stream'
899
+ // browser only: 'blob'
900
+ responseType: 'json', // default
901
+
902
+ // `responseEncoding` indicates encoding to use for decoding responses (Node.js only)
903
+ // Note: Ignored for `responseType` of 'stream' or client-side requests
904
+ // options are: 'ascii', 'ASCII', 'ansi', 'ANSI', 'binary', 'BINARY', 'base64', 'BASE64', 'base64url',
905
+ // 'BASE64URL', 'hex', 'HEX', 'latin1', 'LATIN1', 'ucs-2', 'UCS-2', 'ucs2', 'UCS2', 'utf-8', 'UTF-8',
906
+ // 'utf8', 'UTF8', 'utf16le', 'UTF16LE'
907
+ responseEncoding: 'utf8', // default
908
+
909
+ // `xsrfCookieName` is the name of the cookie to use as a value for the xsrf token
910
+ xsrfCookieName: 'XSRF-TOKEN', // default
911
+
912
+ // `xsrfHeaderName` is the name of the http header that carries the xsrf token value
913
+ xsrfHeaderName: 'X-XSRF-TOKEN', // default
914
+
915
+ // `withXSRFToken` defines whether to send the XSRF header in browser requests.
916
+ // `undefined` (default) - set XSRF header only for the same origin requests
917
+ // `true` - always set XSRF header, including for cross-origin requests
918
+ // `false` - never set XSRF header
919
+ // function - resolve with custom logic; receives the internal config object
920
+ withXSRFToken: boolean | undefined | ((config: InternalAxiosRequestConfig) => boolean | undefined),
921
+
922
+ // `withXSRFToken` controls whether Axios reads the XSRF cookie and sets the XSRF header.
923
+ // - `undefined` (default): the XSRF header is set only for same-origin requests.
924
+ // - `true`: attempt to set the XSRF header for all requests (including cross-origin).
925
+ // - `false`: never set the XSRF header.
926
+ // - function: a callback that receives the request `config` and returns `true`,
927
+ // `false`, or `undefined` to decide per-request behavior.
928
+ //
929
+ // Note about `withCredentials`: `withCredentials` controls whether cross-site
930
+ // requests include credentials (cookies and HTTP auth). In older Axios versions,
931
+ // setting `withCredentials: true` implicitly caused Axios to set the XSRF header
932
+ // for cross-origin requests. Newer Axios separates these concerns: to allow the
933
+ // XSRF header to be sent for cross-origin requests you should set both
934
+ // `withCredentials: true` and `withXSRFToken: true`.
935
+ //
936
+ // Example:
937
+ // axios.get('/user', { withCredentials: true, withXSRFToken: true });
938
+
939
+ // `onUploadProgress` allows handling of progress events for uploads
940
+ // browser & node.js
941
+ onUploadProgress: function ({loaded, total, progress, bytes, estimated, rate, upload = true}) {
942
+ // Do whatever you want with the Axios progress event
943
+ },
944
+
945
+ // `onDownloadProgress` allows handling of progress events for downloads
946
+ // browser & node.js
947
+ onDownloadProgress: function ({loaded, total, progress, bytes, estimated, rate, download = true}) {
948
+ // Do whatever you want with the Axios progress event
949
+ },
950
+
951
+ // `maxContentLength` defines the max size of the response content in bytes.
952
+ // It is enforced by the Node.js HTTP adapter and the fetch adapter.
953
+ maxContentLength: 2000,
954
+
955
+ // `maxBodyLength` defines the max size of the request content in bytes.
956
+ // It is enforced by the Node.js HTTP adapter and the fetch adapter when the body length can be determined.
957
+ maxBodyLength: 2000,
958
+
959
+ // `redact` masks matching config keys when AxiosError#toJSON() is called.
960
+ // Matching is case-insensitive and recursive. It does not change the request.
961
+ redact: ['authorization', 'password'],
962
+
963
+ // `validateStatus` defines whether to resolve or reject the promise for a given
964
+ // HTTP response status code. If `validateStatus` returns `true` or is set to
965
+ // `null`, Axios resolves the promise; otherwise, Axios rejects it.
966
+ // Explicit `validateStatus: undefined` resolves every status by default for
967
+ // backward compatibility. Set `transitional.validateStatusUndefinedResolves`
968
+ // to `false` to make explicit `undefined` behave as if this option was omitted.
969
+ validateStatus: function (status) {
970
+ return status >= 200 && status < 300; // default
971
+ },
972
+
973
+ // `maxRedirects` defines the maximum number of redirects to follow in node.js.
974
+ // If set to 0, Axios follows no redirects.
975
+ maxRedirects: 21, // default
976
+
977
+ // `sensitiveHeaders` (Node only option) lists custom secret-bearing headers
978
+ // (such as `X-API-Key`) to remove from cross-origin redirects. Matching is
979
+ // case-insensitive. Same-origin redirects keep these headers. If
980
+ // `maxRedirects` is 0, this option is not used.
981
+ sensitiveHeaders: ['X-API-Key'],
982
+
983
+ // `beforeRedirect` defines a function that Axios calls before redirect.
984
+ // Use this to adjust the request options upon redirecting,
985
+ // to inspect the latest response headers,
986
+ // or to cancel the request by throwing an error
987
+ // If maxRedirects is set to 0, `beforeRedirect` is not used.
988
+
989
+ beforeRedirect: (options, { headers }) => {
990
+ if (
991
+ options.hostname === "example.com" &&
992
+ options.protocol === "https:"
993
+ ) {
994
+ options.auth = "user:password";
995
+ }
996
+ },
997
+ // Security note:
998
+ // The `beforeRedirect` hook runs after sensitive headers are stripped during redirects.
999
+ // `follow-redirects` removes credentials on protocol downgrades
1000
+ // (HTTPS to HTTP). Because `beforeRedirect` runs after that step,
1001
+ // re-injecting credentials without checking the destination can expose
1002
+ // sensitive data. Only add credentials for trusted HTTPS destinations.
1003
+
1004
+ // `socketPath` defines a UNIX Socket to be used in node.js.
1005
+ // e.g. '/var/run/docker.sock' to send requests to the docker daemon.
1006
+ // Only either `socketPath` or `proxy` can be specified.
1007
+ // If both are specified, `socketPath` is used.
1008
+ //
1009
+ // Security: when `socketPath` is set, hostname/port of the URL are ignored,
1010
+ // which bypasses hostname-based SSRF protections. Never derive `socketPath`
1011
+ // from untrusted input. Use `allowedSocketPaths` (below) to restrict accepted
1012
+ // socket paths for defense-in-depth.
1013
+ socketPath: null, // default
1014
+
1015
+ // `allowedSocketPaths` restricts which `socketPath` values are accepted.
1016
+ // Accepts a string or array of strings. Entries and the incoming socketPath
1017
+ // are compared after path.resolve(). A mismatch throws AxiosError with code
1018
+ // `ERR_BAD_OPTION_VALUE`. When null/undefined, no restriction is applied.
1019
+ allowedSocketPaths: null, // default
1020
+
1021
+ // `transport` determines the transport method for the request.
1022
+ // If defined, Axios uses it. Otherwise, if `maxRedirects` is 0,
1023
+ // Axios uses the default `http` or `https` library, depending on the protocol specified in `protocol`.
1024
+ // Otherwise, Axios uses the `httpFollow` or `httpsFollow` library, again depending on the protocol,
1025
+ // which can handle redirects.
1026
+ transport: undefined, // default
1027
+
1028
+ // `httpAgent` and `httpsAgent` define a custom agent to be used when performing http
1029
+ // and https requests, respectively, in node.js. This allows options to be added like
1030
+ // `keepAlive` that are not enabled by default before Node.js v19.0.0. After Node.js
1031
+ // v19.0.0, you no longer need to customize the agent to enable `keepAlive` because
1032
+ // `http.globalAgent` has `keepAlive` enabled by default.
1033
+ httpAgent: new http.Agent({ keepAlive: true }),
1034
+ httpsAgent: new https.Agent({ keepAlive: true }),
1035
+
1036
+ // `proxy` defines the hostname, port, and protocol of the proxy server.
1037
+ // You can also define your proxy using the conventional `http_proxy` and
1038
+ // `https_proxy` environment variables. If you are using environment variables
1039
+ // for your proxy configuration, you can also define a `no_proxy` environment
1040
+ // variable as a comma-separated list of domains that should not be proxied.
1041
+ // Use `false` to disable proxies, ignoring environment variables.
1042
+ // On Node.js versions with native environment proxy support, axios defers
1043
+ // environment proxy handling to Node when the selected agent has `proxyEnv`
1044
+ // enabled, including processes started with `NODE_USE_ENV_PROXY=1`,
1045
+ // `--use-env-proxy`, or `NODE_OPTIONS=--use-env-proxy`. Custom agents without
1046
+ // `proxyEnv` continue to use axios environment proxy resolution. Explicit
1047
+ // `proxy` config is still handled by axios.
1048
+ // `auth` indicates that HTTP Basic auth should be used to connect to the proxy, and
1049
+ // supplies credentials.
1050
+ // For `http://` targets, axios sends the request to the proxy in
1051
+ // forward-proxy mode and stamps `Proxy-Authorization` onto the request
1052
+ // headers (overwriting any user-supplied `Proxy-Authorization` header).
1053
+ // For `https://` targets, axios establishes a CONNECT tunnel through the
1054
+ // proxy and performs TLS end-to-end with the origin; `Proxy-Authorization`
1055
+ // is sent on the CONNECT request only, never on the wrapped TLS request,
1056
+ // so the proxy never sees the URL, headers, or body. Axios forwards
1057
+ // `httpsAgent` TLS options such as `ca`, `cert`, `key`, and
1058
+ // `rejectUnauthorized` to the generated tunneling agent, so they still apply
1059
+ // to the origin TLS connection.
1060
+ // If you supply an `HttpsProxyAgent`, axios leaves tunneling to that agent.
1061
+ // If the proxy server uses HTTPS, then you must set the protocol to `https`.
1062
+ // A user-supplied `Host` header in `headers` is preserved when forwarding
1063
+ // through a proxy (case-insensitive match on `host`/`Host`/`HOST`); this
1064
+ // lets you target a virtual host that differs from the request URL, for
1065
+ // example, hitting `127.0.0.1:4000` while having the proxy treat the
1066
+ // request as `example.com`. If no `Host` header is supplied, axios
1067
+ // defaults it to the request URL's `hostname:port` as before. The Host
1068
+ // header is only set in forward-proxy mode (HTTP targets); for HTTPS
1069
+ // tunneling the Host header is sent inside the TLS connection, not seen
1070
+ // by the proxy.
1071
+ proxy: {
1072
+ protocol: 'https',
1073
+ host: '127.0.0.1',
1074
+ // hostname: '127.0.0.1' // Takes precedence over 'host' if both are defined
1075
+ port: 9000,
1076
+ auth: {
1077
+ username: 'mikeymike',
1078
+ password: 'rapunz3l'
1079
+ }
1080
+ },
1081
+
1082
+ // `cancelToken` specifies a cancel token that can be used to cancel the request
1083
+ // (see Cancellation section below for details)
1084
+ cancelToken: new CancelToken(function (cancel) {
1085
+ }),
1086
+
1087
+ // an alternative way to cancel Axios requests using AbortController
1088
+ signal: new AbortController().signal,
1089
+
1090
+ // `decompress` indicates whether or not the response body should be decompressed
1091
+ // automatically. If set to `true` will also remove the 'content-encoding' header
1092
+ // from the responses objects of all decompressed responses
1093
+ // Axios supports gzip, deflate, brotli, and zstd when the current Node.js
1094
+ // runtime provides the corresponding zlib decompressor.
1095
+ // - Node only (XHR cannot turn off decompression)
1096
+ decompress: true, // default
1097
+
1098
+ // `insecureHTTPParser` boolean.
1099
+ // Indicates where to use an insecure HTTP parser that accepts invalid HTTP headers.
1100
+ // This may allow interoperability with non-conformant HTTP implementations.
1101
+ // Using the insecure parser should be avoided.
1102
+ // see options https://nodejs.org/dist/latest-v12.x/docs/api/http.html#http_http_request_url_options_callback
1103
+ // see also https://nodejs.org/en/blog/vulnerability/february-2020-security-releases/#strict-http-header-parsing-none
1104
+ insecureHTTPParser: undefined, // default
1105
+
1106
+ // transitional options for backward compatibility that may be removed in the newer versions
1107
+ transitional: {
1108
+ // silent JSON parsing mode
1109
+ // `true` - ignore JSON parsing errors and set response.data to null if parsing failed (old behaviour)
1110
+ // `false` - throw SyntaxError if JSON parsing failed
1111
+ // Important: this option only takes effect when `responseType` is explicitly set to 'json'.
1112
+ // When `responseType` is omitted (defaults to no value), axios uses `forcedJSONParsing`
1113
+ // to attempt JSON parsing, but will silently return the raw string on failure regardless
1114
+ // of this setting. To have invalid JSON throw errors, use:
1115
+ // { responseType: 'json', transitional: { silentJSONParsing: false } }
1116
+ silentJSONParsing: true, // default value for the current Axios version
1117
+
1118
+ // try to parse the response string as JSON even if `responseType` is not 'json'
1119
+ forcedJSONParsing: true,
1120
+
1121
+ // throw ETIMEDOUT error instead of generic ECONNABORTED on request timeouts
1122
+ clarifyTimeoutError: false,
1123
+
1124
+ // keep explicit `validateStatus: undefined` resolving every response status
1125
+ // for backward compatibility. Set to false to make explicit undefined behave
1126
+ // as if validateStatus was omitted.
1127
+ validateStatusUndefinedResolves: true,
1128
+
1129
+ // advertise `zstd` in the default Accept-Encoding header when the current
1130
+ // Node.js runtime supports zstd decompression. Axios still decompresses
1131
+ // zstd responses when support exists and `decompress` is true.
1132
+ advertiseZstdAcceptEncoding: false,
1133
+
1134
+ // use the legacy interceptor request/response ordering
1135
+ legacyInterceptorReqResOrdering: true, // default
1136
+ },
1137
+
1138
+ env: {
1139
+ // The FormData class to be used to automatically serialize the payload into a FormData object
1140
+ FormData: window?.FormData || global?.FormData
1141
+ },
1142
+
1143
+ formSerializer: {
1144
+ visitor: (value, key, path, helpers) => {}; // custom visitor function to serialize form values
1145
+ dots: boolean; // use dots instead of brackets format
1146
+ metaTokens: boolean; // keep special endings like {} in parameter key
1147
+ indexes: boolean; // array indexes format null - no brackets, false - empty brackets, true - brackets with indexes
1148
+ maxDepth: 100; // maximum object nesting depth; throws AxiosError (ERR_FORM_DATA_DEPTH_EXCEEDED) if exceeded. Set to Infinity to disable.
1149
+ },
1150
+
1151
+ // http adapter only (node.js)
1152
+ maxRate: [
1153
+ 100 * 1024, // 100KB/s upload limit,
1154
+ 100 * 1024 // 100KB/s download limit
1155
+ ]
1156
+ }
1157
+ ```
1158
+
1159
+ For custom secret-bearing headers in Node.js, list them in `sensitiveHeaders` so Axios removes them when following a redirect to another origin:
1160
+
1161
+ ```js
1162
+ axios.get('https://api.example.com/users', {
1163
+ headers: { 'X-API-Key': 'secret' },
1164
+ sensitiveHeaders: ['X-API-Key'],
1165
+ });
1166
+ ```
1167
+
1168
+ ### Strict RFC 3986 percent-encoding for query params
1169
+
1170
+ 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.
1171
+
1172
+ Override the default encoder via `paramsSerializer.encode`:
1173
+
1174
+ ```js
1175
+ // Per-request: emit strict RFC 3986 percent-encoding for query values
1176
+ axios.get('/foo', {
1177
+ params: { filter: JSON.stringify({ startedAt: '2026-01-23' }) },
1178
+ paramsSerializer: { encode: encodeURIComponent },
1179
+ });
1180
+
1181
+ // Or set it on the instance defaults
1182
+ const client = axios.create({
1183
+ paramsSerializer: { encode: encodeURIComponent },
1184
+ });
1185
+ ```
1186
+
1187
+ ## HTTP/2 support
1188
+
1189
+ Axios has experimental HTTP/2 support in the Node.js HTTP adapter.
1190
+
1191
+ Support depends on the runtime environment and Node.js version. Redirects and some adapter behavior may differ from HTTP/1.1.
1192
+
1193
+ Options like `httpVersion` and `http2Options` are adapter-specific and may not work the same way in every environment.
1194
+
1195
+ If you need HTTP/2, check runtime support or use a custom adapter.
1196
+
1197
+ ## Response schema
1198
+
1199
+ The response to a request contains the following information.
1200
+
1201
+ ```js
1202
+ {
1203
+ // `data` is the response that was provided by the server
1204
+ data: {},
1205
+
1206
+ // `status` is the HTTP status code from the server response
1207
+ status: 200,
1208
+
1209
+ // `statusText` is the HTTP status message from the server response
1210
+ statusText: 'OK',
1211
+
1212
+ // `headers` the HTTP headers that the server responded with
1213
+ // All header names are lowercase and can be accessed using the bracket notation.
1214
+ // Example: `response.headers['content-type']`
1215
+ headers: {},
1216
+
1217
+ // `config` is the config that was provided to `axios` for the request
1218
+ config: {},
1219
+
1220
+ // `request` is the request that generated this response
1221
+ // It is the last ClientRequest instance in node.js (in redirects)
1222
+ // and an XMLHttpRequest instance in the browser
1223
+ request: {}
1224
+ }
1225
+ ```
1226
+
1227
+ When using `then`, you receive the response like this:
1228
+
1229
+ ```js
1230
+ const response = await axios.get('/user/12345');
1231
+ console.log(response.data);
1232
+ console.log(response.status);
1233
+ console.log(response.statusText);
1234
+ console.log(response.headers);
1235
+ console.log(response.config);
1236
+ ```
1237
+
1238
+ 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).
1239
+
1240
+ ## Config defaults
1241
+
1242
+ Config defaults apply to every request.
1243
+
1244
+ ### Global axios defaults
1245
+
1246
+ ```js
1247
+ axios.defaults.baseURL = 'https://api.example.com';
1248
+
1249
+ // Important: If you use axios with multiple domains, Axios sends AUTH_TOKEN to all of them.
1250
+ // See below for an example using Custom instance defaults instead.
1251
+ axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
1252
+
1253
+ axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
1254
+ ```
1255
+
1256
+ ### Custom instance defaults
1257
+
1258
+ ```js
1259
+ // Set config defaults when creating the instance
1260
+ const instance = axios.create({
1261
+ baseURL: 'https://api.example.com',
1262
+ });
1263
+
1264
+ // Alter defaults after instance has been created
1265
+ instance.defaults.headers.common['Authorization'] = AUTH_TOKEN;
1266
+ ```
1267
+
1268
+ ### Config order of precedence
1269
+
1270
+ 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.
1271
+
1272
+ 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.
1273
+
1274
+ ```js
1275
+ // Create an instance using the config defaults provided by the library
1276
+ // At this point the timeout config value is `0` as is the default for the library
1277
+ const instance = axios.create();
1278
+
1279
+ // Override timeout default for the library
1280
+ // Now all requests using this instance will wait 2.5 seconds before timing out
1281
+ instance.defaults.timeout = 2500;
1282
+
1283
+ // Override timeout for this request as it's known to take a long time
1284
+ instance.get('/longRequest', {
1285
+ timeout: 5000,
1286
+ });
1287
+ ```
1288
+
1289
+ ## Interceptors
1290
+
1291
+ You can intercept requests or responses before methods like `.get()` or `.post()`
1292
+ resolve their promises (before code inside `then` or `catch`, or after `await`)
1293
+
1294
+ ```js
1295
+ const instance = axios.create();
1296
+
1297
+ // Add a request interceptor
1298
+ instance.interceptors.request.use(
1299
+ function (config) {
1300
+ // Do something before the request is sent
1301
+ return config;
1302
+ },
1303
+ function (error) {
1304
+ // Do something with the request error
1305
+ return Promise.reject(error);
1306
+ }
1307
+ );
1308
+
1309
+ // Add a response interceptor
1310
+ instance.interceptors.response.use(
1311
+ function (response) {
1312
+ // Any status code that lies within the range of 2xx causes this function to trigger
1313
+ // Do something with response data
1314
+ return response;
1315
+ },
1316
+ function (error) {
1317
+ // Any status codes that fall outside the range of 2xx cause this function to trigger
1318
+ // Do something with response error
1319
+ return Promise.reject(error);
1320
+ }
1321
+ );
1322
+ ```
1323
+
1324
+ If you need to remove an interceptor later you can.
1325
+
1326
+ ```js
1327
+ const instance = axios.create();
1328
+ const myInterceptor = instance.interceptors.request.use(function () {
1329
+ /*...*/
1330
+ });
1331
+ instance.interceptors.request.eject(myInterceptor);
1332
+ ```
1333
+
1334
+ You can also clear all interceptors for requests or responses.
1335
+
1336
+ ```js
1337
+ const instance = axios.create();
1338
+ instance.interceptors.request.use(function () {
1339
+ /*...*/
1340
+ });
1341
+ instance.interceptors.request.clear(); // Removes interceptors from requests
1342
+ instance.interceptors.response.use(function () {
1343
+ /*...*/
1344
+ });
1345
+ instance.interceptors.response.clear(); // Removes interceptors from responses
1346
+ ```
1347
+
1348
+ You can add interceptors to a custom instance of axios.
1349
+
1350
+ ```js
1351
+ const instance = axios.create();
1352
+ instance.interceptors.request.use(function () {
1353
+ /*...*/
1354
+ });
1355
+ ```
1356
+
1357
+ When you add request interceptors, they are presumed to be asynchronous by default. This can cause a delay
1358
+ in the execution of your axios request when the main thread is blocked (a promise is created under the hood for
1359
+ the interceptor and your request gets put at the bottom of the call stack). If your request interceptors are synchronous you can add a flag
1360
+ to the options object that will tell axios to run the code synchronously and avoid any delays in request execution.
1361
+
1362
+ ```js
1363
+ axios.interceptors.request.use(
1364
+ function (config) {
1365
+ config.headers.test = 'I am only a header!';
1366
+ return config;
1367
+ },
1368
+ null,
1369
+ { synchronous: true }
1370
+ );
1371
+ ```
1372
+
1373
+ If a synchronous request interceptor throws, Axios calls that interceptor's paired rejection handler and stops running the remaining request interceptors. A rejection handler that returns normally, including one that returns `undefined` or a fulfilled Promise, treats the error as handled: Axios dispatches the request with the last valid config, and ignores the handler's return value. To block dispatch, omit the rejection handler or throw/return a rejected Promise from it. The final error then continues through response rejection interceptors.
1374
+
1375
+ Use a rejected Promise when validation must prevent the request:
1376
+
1377
+ ```js
1378
+ axios.interceptors.request.use(
1379
+ function validate(config) {
1380
+ if (!config.headers.has('Authorization')) {
1381
+ throw new Error('Authorization is required');
1382
+ }
1383
+ return config;
1384
+ },
1385
+ function rejectInvalidRequest(error) {
1386
+ return Promise.reject(error);
1387
+ },
1388
+ { synchronous: true }
1389
+ );
1390
+ ```
1391
+
1392
+ A logging-only rejection handler can return normally to preserve the existing request-continuation behavior:
1393
+
1394
+ ```js
1395
+ axios.interceptors.request.use(
1396
+ function prepare(config) {
1397
+ throw new Error('Optional preparation failed');
1398
+ },
1399
+ function logPreparationFailure(error) {
1400
+ console.warn(error);
1401
+ // Returning normally dispatches with the last valid config.
1402
+ },
1403
+ { synchronous: true }
1404
+ );
1405
+ ```
1406
+
1407
+ If you want to execute a particular interceptor based on a runtime check,
1408
+ you can add a `runWhen` function to the options object. The request interceptor will not run **if and only if** the return
1409
+ of `runWhen` is `false`. Axios calls the function with the config
1410
+ object (don't forget that you can bind your own arguments to it as well.) This can be handy when you have an
1411
+ asynchronous request interceptor that only needs to run at certain times.
1412
+
1413
+ ```js
1414
+ function onGetCall(config) {
1415
+ return config.method === 'get';
1416
+ }
1417
+ axios.interceptors.request.use(
1418
+ function (config) {
1419
+ config.headers.test = 'special get headers';
1420
+ return config;
1421
+ },
1422
+ null,
1423
+ { runWhen: onGetCall }
1424
+ );
1425
+ ```
1426
+
1427
+ > Note: The options parameter (with `synchronous` and `runWhen` properties) is only supported for request interceptors at the moment.
1428
+
1429
+ ### Interceptor execution order
1430
+
1431
+ Request and response interceptors use different execution orders.
1432
+
1433
+ Request interceptors run in reverse order (LIFO: last in, first out). The last interceptor added runs first.
1434
+
1435
+ Response interceptors run in the order they were added (FIFO: first in, first out). The first interceptor added runs first.
1436
+
1437
+ Example:
1438
+
1439
+ ```js
1440
+ const instance = axios.create();
1441
+
1442
+ const interceptor = (id) => (base) => {
1443
+ console.log(id);
1444
+ return base;
1445
+ };
1446
+
1447
+ instance.interceptors.request.use(interceptor('Request Interceptor 1'));
1448
+ instance.interceptors.request.use(interceptor('Request Interceptor 2'));
1449
+ instance.interceptors.request.use(interceptor('Request Interceptor 3'));
1450
+ instance.interceptors.response.use(interceptor('Response Interceptor 1'));
1451
+ instance.interceptors.response.use(interceptor('Response Interceptor 2'));
1452
+ instance.interceptors.response.use(interceptor('Response Interceptor 3'));
1453
+
1454
+ // Console output:
1455
+ // Request Interceptor 3
1456
+ // Request Interceptor 2
1457
+ // Request Interceptor 1
1458
+ // [HTTP request is made]
1459
+ // Response Interceptor 1
1460
+ // Response Interceptor 2
1461
+ // Response Interceptor 3
1462
+ ```
1463
+
1464
+ ### Multiple interceptors
1465
+
1466
+ When a response is fulfilled and multiple response interceptors are registered:
1467
+
1468
+ - Each interceptor runs in registration order.
1469
+ - Each interceptor receives the result from the previous interceptor.
1470
+ - The chain returns the result from the last interceptor.
1471
+ - If a fulfillment interceptor throws, Axios skips the next fulfillment interceptor and calls the next rejection interceptor.
1472
+ - After the error is caught, later fulfillment interceptors run again, just like in a promise chain.
1473
+
1474
+ Read [the interceptor tests](./tests/browser/interceptors.browser.test.js) to see all this in code.
1475
+
1476
+ ## Error types
1477
+
1478
+ Axios error messages include details that can help you debug the request.
1479
+
1480
+ Axios errors use this structure:
1481
+ | Property | Definition |
1482
+ | -------- | ---------- |
1483
+ | message | A quick summary of the error message and the status it failed with. |
1484
+ | name | This defines where the error originated from. For axios, it will always be an 'AxiosError'. |
1485
+ | stack | Stack trace for the error. |
1486
+ | config | An axios config object with specific instance configurations defined by the user from when the request was made |
1487
+ | code | Axios error code. The table below lists internal Axios error codes. |
1488
+ | status | HTTP response status code. See [here](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes) for common HTTP response status code meanings.
1489
+
1490
+ These are the internal Axios error codes:
1491
+
1492
+ | Code | Definition |
1493
+ | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1494
+ | ERR_BAD_OPTION_VALUE | Invalid value provided in axios configuration. |
1495
+ | ERR_BAD_OPTION | Invalid option provided in axios configuration. |
1496
+ | ERR_NOT_SUPPORT | Feature or method not supported in the current axios environment. |
1497
+ | ERR_DEPRECATED | Deprecated feature or method used in axios. |
1498
+ | ERR_INVALID_URL | Invalid URL provided for axios request. |
1499
+ | ECONNABORTED | Typically indicates that the request has been timed out (unless `transitional.clarifyTimeoutError` is set) or aborted by the browser or its plugin. |
1500
+ | ERR_CANCELED | The user explicitly canceled the request with an AbortSignal or CancelToken. |
1501
+ | ETIMEDOUT | Request timed out after exceeding the configured Axios timeout. Set `transitional.clarifyTimeoutError` to `true`; otherwise Axios throws a generic `ECONNABORTED` error. |
1502
+ | 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. |
1503
+ | ERR_FR_TOO_MANY_REDIRECTS | Request exceeded the configured maximum number of redirects. |
1504
+ | ERR_BAD_RESPONSE | Response cannot be parsed properly or is in an unexpected format. Usually related to a response with `5xx` status code. |
1505
+ | ERR_BAD_REQUEST | The request has an unexpected format or is missing required parameters. Usually related to a response with `4xx` status code. |
1506
+
1507
+ ## Handling errors
1508
+
1509
+ By default, Axios rejects responses with status codes outside the 2xx range.
1510
+
1511
+ ```js
1512
+ axios.get('/user/12345').catch(function (error) {
1513
+ if (error.response) {
1514
+ // The request was made and the server responded with a status code
1515
+ // that falls out of the range of 2xx
1516
+ console.log(error.response.data);
1517
+ console.log(error.response.status);
1518
+ console.log(error.response.headers);
1519
+ } else if (error.request) {
1520
+ // The request was made but no response was received
1521
+ // `error.request` is an instance of XMLHttpRequest in the browser and an instance of
1522
+ // http.ClientRequest in node.js
1523
+ console.log(error.request);
1524
+ } else {
1525
+ // Something happened in setting up the request that triggered an Error
1526
+ console.log('Error', error.message);
1527
+ }
1528
+ console.log(error.config);
1529
+ });
1530
+ ```
1531
+
1532
+ Axios rejects an `http:` or `https:` request `url` or `baseURL` that omits `//` after the protocol. For example, `https:example.com` and `https:/example.com` reject with `AxiosError` code `ERR_INVALID_URL` instead of being silently normalized. Pass a well-formed URL such as `https://example.com`.
1533
+
1534
+ The error identifies the malformed URL, for example `Invalid URL "https:example.com": missing "//" after protocol`. To keep logs useful without leaking secrets, Axios reports the control-character-normalized URL with credentials, query parameter values, and fragment contents redacted; the scheme, host, path, and query parameter names remain visible.
1535
+
1536
+ Use `validateStatus` to override the default condition (`status >= 200 && status < 300`) and choose which HTTP status codes should reject.
1537
+
1538
+ ```js
1539
+ axios.get('/user/12345', {
1540
+ validateStatus: function (status) {
1541
+ return status < 500; // Resolve only if the status code is less than 500
1542
+ },
1543
+ });
1544
+ ```
1545
+
1546
+ 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.
1547
+
1548
+ `validateStatus: null` still accepts every response status. If you disable the transitional behavior and intentionally want all statuses to resolve, use `null` or `() => true`.
1549
+
1550
+ ```js
1551
+ axios.get('/user/12345', {
1552
+ validateStatus: undefined,
1553
+ transitional: {
1554
+ validateStatusUndefinedResolves: false,
1555
+ },
1556
+ });
1557
+ ```
1558
+
1559
+ Use `toJSON` to get more information about the HTTP error.
1560
+
1561
+ ```js
1562
+ axios.get('/user/12345').catch(function (error) {
1563
+ console.log(error.toJSON());
1564
+ });
1565
+ ```
1566
+
1567
+ 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.
1568
+
1569
+ ```js
1570
+ axios
1571
+ .get('/user/12345', {
1572
+ headers: { Authorization: 'Bearer token' },
1573
+ redact: ['authorization'],
1574
+ })
1575
+ .catch(function (error) {
1576
+ console.log(error.toJSON().config.headers.Authorization); // [REDACTED ****]
1577
+ });
1578
+ ```
1579
+
1580
+ ## Handling timeouts
1581
+
1582
+ ```js
1583
+ async function fetchWithTimeout() {
1584
+ try {
1585
+ const response = await axios.get('https://example.com/data', {
1586
+ timeout: 5000, // 5 seconds
1587
+ transitional: {
1588
+ // set to true if you prefer ETIMEDOUT over ECONNABORTED
1589
+ clarifyTimeoutError: false,
1590
+ },
1591
+ });
1592
+
1593
+ console.log('Response:', response.data);
1594
+ } catch (error) {
1595
+ if (axios.isAxiosError(error)) {
1596
+ if (error.code === 'ECONNABORTED' || error.code === 'ETIMEDOUT') {
1597
+ console.error('Request timed out. Please try again.');
1598
+ return;
1599
+ }
1600
+
1601
+ console.error('Axios error:', error.message);
1602
+ return;
1603
+ }
1604
+
1605
+ console.error('Unexpected error:', error);
1606
+ }
1607
+ }
1608
+ ```
1609
+
1610
+ ## Cancellation
1611
+
1612
+ ### AbortController
1613
+
1614
+ Since `v0.22.0`, Axios supports AbortController:
1615
+
1616
+ ```js
1617
+ const controller = new AbortController();
1618
+
1619
+ axios
1620
+ .get('/foo/bar', {
1621
+ signal: controller.signal,
1622
+ })
1623
+ .then(function (response) {
1624
+ //...
1625
+ });
1626
+ // cancel the request
1627
+ controller.abort();
1628
+ ```
1629
+
1630
+ ### CancelToken (deprecated)
1631
+
1632
+ You can also cancel a request using a _CancelToken_.
1633
+
1634
+ > The axios cancel token API is based on the withdrawn [cancellable promises proposal](https://github.com/tc39/proposal-cancelable-promises).
1635
+
1636
+ > This API is deprecated since v0.22.0 and should not be used in new projects.
1637
+
1638
+ Create a cancel token with the `CancelToken.source` factory:
1639
+
1640
+ ```js
1641
+ const CancelToken = axios.CancelToken;
1642
+ const source = CancelToken.source();
1643
+
1644
+ axios
1645
+ .get('/user/12345', {
1646
+ cancelToken: source.token,
1647
+ })
1648
+ .catch(function (thrown) {
1649
+ if (axios.isCancel(thrown)) {
1650
+ console.log('Request canceled', thrown.message);
1651
+ } else {
1652
+ // handle error
1653
+ }
1654
+ });
1655
+
1656
+ axios.post(
1657
+ '/user/12345',
1658
+ {
1659
+ name: 'new name',
1660
+ },
1661
+ {
1662
+ cancelToken: source.token,
1663
+ }
1664
+ );
1665
+
1666
+ // cancel the request (the message parameter is optional)
1667
+ source.cancel('Operation canceled by the user.');
1668
+ ```
1669
+
1670
+ You can also pass an executor function to the `CancelToken` constructor:
1671
+
1672
+ ```js
1673
+ const CancelToken = axios.CancelToken;
1674
+ let cancel;
1675
+
1676
+ axios.get('/user/12345', {
1677
+ cancelToken: new CancelToken(function executor(c) {
1678
+ // An executor function receives a cancel function as a parameter
1679
+ cancel = c;
1680
+ }),
1681
+ });
1682
+
1683
+ // cancel the request
1684
+ cancel();
1685
+ ```
1686
+
1687
+ `CancelToken` also exposes low-level helpers for legacy integrations:
1688
+
1689
+ ```js
1690
+ const source = axios.CancelToken.source();
1691
+
1692
+ const listener = (cancel) => {
1693
+ console.log(cancel.message);
1694
+ };
1695
+
1696
+ source.token.subscribe(listener);
1697
+
1698
+ const signal = source.token.toAbortSignal();
1699
+ // Pass `signal` to APIs that accept AbortSignal.
1700
+
1701
+ source.cancel('Operation canceled by the user.');
1702
+ source.token.unsubscribe(listener);
1703
+ ```
1704
+
1705
+ 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.
1706
+
1707
+ > Note: You can cancel several requests with the same cancel token or abort controller.
1708
+ > If a cancellation token is already cancelled when an Axios request starts, Axios cancels the request immediately without making a real request.
1709
+
1710
+ > During the transition period, you can use both cancellation APIs, even for the same request:
1711
+
1712
+ ```js
1713
+ const controller = new AbortController();
1714
+ const source = axios.CancelToken.source();
1715
+
1716
+ axios.get('/user/12345', {
1717
+ cancelToken: source.token,
1718
+ signal: controller.signal,
1719
+ });
1720
+
1721
+ controller.abort();
1722
+ source.cancel('Operation canceled by the user.');
1723
+ ```
1724
+
1725
+ ## Using `application/x-www-form-urlencoded` format
1726
+
1727
+ ### URLSearchParams
1728
+
1729
+ 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.
1730
+
1731
+ ```js
1732
+ const params = new URLSearchParams({ foo: 'bar' });
1733
+ params.append('extraparam', 'value');
1734
+ axios.post('/foo', params);
1735
+ ```
1736
+
1737
+ ### Query string (older browsers)
1738
+
1739
+ For very old browsers, use a [polyfill](https://github.com/WebReflection/url-search-params) and make sure it patches the global environment.
1740
+
1741
+ Alternatively, you can encode data using the [`qs`](https://github.com/ljharb/qs) library:
1742
+
1743
+ ```js
1744
+ const qs = require('qs');
1745
+ axios.post('/foo', qs.stringify({ bar: 123 }));
1746
+ ```
1747
+
1748
+ With ES modules:
1749
+
1750
+ ```js
1751
+ import qs from 'qs';
1752
+ const data = { bar: 123 };
1753
+ const options = {
1754
+ method: 'POST',
1755
+ headers: { 'content-type': 'application/x-www-form-urlencoded' },
1756
+ data: qs.stringify(data),
1757
+ url,
1758
+ };
1759
+ axios(options);
1760
+ ```
1761
+
1762
+ ### Older Node.js versions
1763
+
1764
+ For older Node.js engines, use the [`querystring`](https://nodejs.org/api/querystring.html) module:
1765
+
1766
+ ```js
1767
+ const querystring = require('querystring');
1768
+ axios.post('https://something.com/', querystring.stringify({ foo: 'bar' }));
1769
+ ```
1770
+
1771
+ You can also use the [`qs`](https://github.com/ljharb/qs) library.
1772
+
1773
+ > 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.
1774
+
1775
+ ### Automatic serialization to URLSearchParams
1776
+
1777
+ Axios automatically serializes the data object to urlencoded format if the content-type header is set to "application/x-www-form-urlencoded".
1778
+
1779
+ ```js
1780
+ const data = {
1781
+ x: 1,
1782
+ arr: [1, 2, 3],
1783
+ arr2: [1, [2], 3],
1784
+ users: [
1785
+ { name: 'Peter', surname: 'Griffin' },
1786
+ { name: 'Thomas', surname: 'Anderson' },
1787
+ ],
1788
+ };
1789
+
1790
+ await axios.postForm('https://postman-echo.com/post', data, {
1791
+ headers: { 'content-type': 'application/x-www-form-urlencoded' },
1792
+ });
1793
+ ```
1794
+
1795
+ The server receives these fields:
1796
+
1797
+ ```js
1798
+ {
1799
+ x: '1',
1800
+ 'arr[]': [ '1', '2', '3' ],
1801
+ 'arr2[0]': '1',
1802
+ 'arr2[1][0]': '2',
1803
+ 'arr2[2]': '3',
1804
+ 'arr3[]': [ '1', '2', '3' ],
1805
+ 'users[0][name]': 'Peter',
1806
+ 'users[0][surname]': 'griffin',
1807
+ 'users[1][name]': 'Thomas',
1808
+ 'users[1][surname]': 'Anderson'
1809
+ }
1810
+ ```
1811
+
1812
+ If your backend body parser, such as `body-parser` for `express.js`, supports nested object decoding, the server receives the same object structure:
1813
+
1814
+ ```js
1815
+ const app = express();
1816
+
1817
+ app.use(bodyParser.urlencoded({ extended: true })); // support encoded bodies
1818
+
1819
+ app.post('/', function (req, res, next) {
1820
+ // echo body as JSON
1821
+ res.send(JSON.stringify(req.body));
1822
+ });
1823
+
1824
+ server = app.listen(3000);
1825
+ ```
1826
+
1827
+ ## Using `multipart/form-data` format
1828
+
1829
+ ### FormData
1830
+
1831
+ To send data as `multipart/form-data`, pass a FormData instance as the payload.
1832
+ You do not need to set the `Content-Type` header. Axios detects it from the payload type.
1833
+ For browser, web worker, and React Native `FormData`, leave `Content-Type` unset so the runtime can add the multipart boundary.
1834
+
1835
+ ```js
1836
+ const formData = new FormData();
1837
+ formData.append('foo', 'bar');
1838
+
1839
+ axios.post('https://httpbin.org/post', formData);
1840
+ ```
1841
+
1842
+ In node.js, use the [`form-data`](https://github.com/form-data/form-data) library:
1843
+
1844
+ ```js
1845
+ const FormData = require('form-data');
1846
+
1847
+ const form = new FormData();
1848
+ form.append('my_field', 'my value');
1849
+ form.append('my_buffer', Buffer.alloc(10));
1850
+ form.append('my_file', fs.createReadStream('/foo/bar.jpg'));
1851
+
1852
+ axios.post('https://example.com', form);
1853
+ ```
1854
+
1855
+ 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.
1856
+
1857
+ ### Automatic serialization to FormData
1858
+
1859
+ Since `v0.27.0`, Axios can serialize an object to FormData if the request `Content-Type`
1860
+ header is set to `multipart/form-data`.
1861
+
1862
+ This request submits data as FormData in browsers and Node.js:
1863
+
1864
+ ```js
1865
+ import axios from 'axios';
1866
+
1867
+ axios
1868
+ .post(
1869
+ 'https://httpbin.org/post',
1870
+ { x: 1 },
1871
+ {
1872
+ headers: {
1873
+ 'Content-Type': 'multipart/form-data',
1874
+ },
1875
+ }
1876
+ )
1877
+ .then(({ data }) => console.log(data));
1878
+ ```
1879
+
1880
+ The Node.js build uses the [`form-data`](https://github.com/form-data/form-data) polyfill by default.
1881
+
1882
+ You can override the FormData class with the `env.FormData` config option, but most applications do not need this:
1883
+
1884
+ ```js
1885
+ const axios = require('axios');
1886
+ var FormData = require('form-data');
1887
+
1888
+ axios
1889
+ .post(
1890
+ 'https://httpbin.org/post',
1891
+ { x: 1, buf: Buffer.alloc(10) },
1892
+ {
1893
+ headers: {
1894
+ 'Content-Type': 'multipart/form-data',
1895
+ },
1896
+ }
1897
+ )
1898
+ .then(({ data }) => console.log(data));
1899
+ ```
1900
+
1901
+ The Axios FormData serializer supports these special endings:
1902
+
1903
+ - `{}` - serialize the value with JSON.stringify
1904
+ - `[]` - unwrap the array-like object as separate fields with the same key
1905
+
1906
+ > Note: Arrays and FileList objects are unwrapped by default.
1907
+
1908
+ FormData serializer supports additional options via `config.formSerializer: object` property to handle rare cases:
1909
+
1910
+ - `visitor: Function` - user-defined visitor function that Axios calls recursively to serialize the data object
1911
+ to a `FormData` object by following custom rules.
1912
+
1913
+ - `dots: boolean = false` - use dot notation instead of brackets to serialize arrays and objects;
1914
+
1915
+ - `metaTokens: boolean = true` - add the special ending (e.g `user{}: '{"name": "John"}'`) in the FormData key.
1916
+ A backend body parser can use this meta-information to parse the value as JSON.
1917
+
1918
+ - `indexes: null|false|true = false` - controls how Axios adds indexes to unwrapped keys of `flat` array-like objects.
1919
+ - `null` - don't add brackets (`arr: 1`, `arr: 2`, `arr: 3`)
1920
+ - `false`(default) - add empty brackets (`arr[]: 1`, `arr[]: 2`, `arr[]: 3`)
1921
+ - `true` - add brackets with indexes (`arr[0]: 1`, `arr[1]: 2`, `arr[2]: 3`)
1922
+ - `maxDepth: number = 100` - maximum object nesting depth the serializer will recurse into. If the
1923
+ input object exceeds this depth, an `AxiosError` with `code: 'ERR_FORM_DATA_DEPTH_EXCEEDED'` is
1924
+ thrown instead of overflowing the call stack. This protects server applications from DoS
1925
+ attacks via deeply nested payloads. Set to `Infinity` to disable the limit and restore pre-fix behaviour.
1926
+ - `Blob: typeof Blob` - Blob constructor used when converting ArrayBuffer-like values for spec-compliant
1927
+ `FormData`. Override it only for runtimes that provide a compatible `Blob` constructor under a
1928
+ different binding.
1929
+
1930
+ ```js
1931
+ // Raise the limit for a schema that genuinely nests deeper than 100 levels:
1932
+ axios.postForm('/api', data, { formSerializer: { maxDepth: 200 } });
1933
+
1934
+ // Same protection applies to params serialization:
1935
+ axios.get('/api', { params: data, paramsSerializer: { maxDepth: 200 } });
1936
+ ```
1937
+
1938
+ Given this object:
1939
+
1940
+ ```js
1941
+ const obj = {
1942
+ x: 1,
1943
+ arr: [1, 2, 3],
1944
+ arr2: [1, [2], 3],
1945
+ users: [
1946
+ { name: 'Peter', surname: 'Griffin' },
1947
+ { name: 'Thomas', surname: 'Anderson' },
1948
+ ],
1949
+ 'obj2{}': [{ x: 1 }],
1950
+ };
1951
+ ```
1952
+
1953
+ The Axios serializer appends these fields:
1954
+
1955
+ ```js
1956
+ const formData = new FormData();
1957
+ formData.append('x', '1');
1958
+ formData.append('arr[]', '1');
1959
+ formData.append('arr[]', '2');
1960
+ formData.append('arr[]', '3');
1961
+ formData.append('arr2[0]', '1');
1962
+ formData.append('arr2[1][0]', '2');
1963
+ formData.append('arr2[2]', '3');
1964
+ formData.append('users[0][name]', 'Peter');
1965
+ formData.append('users[0][surname]', 'Griffin');
1966
+ formData.append('users[1][name]', 'Thomas');
1967
+ formData.append('users[1][surname]', 'Anderson');
1968
+ formData.append('obj2{}', '[{"x":1}]');
1969
+ ```
1970
+
1971
+ ### Converting FormData to JSON
1972
+
1973
+ `axios.formToJSON()` converts `FormData` field names that use dot or bracket notation into nested objects and arrays. Only `.`, `[`, and `]` are structural separators. Other characters, including `-`, spaces, `+`, `*`, and `&`, remain part of the literal key.
1974
+
1975
+ ```js
1976
+ const form = new FormData();
1977
+ form.append('user-name', 'johndoe');
1978
+ form.append('user.name', 'john');
1979
+
1980
+ console.log(axios.formToJSON(form));
1981
+ // {
1982
+ // 'user-name': 'johndoe',
1983
+ // user: { name: 'john' }
1984
+ // }
1985
+ ```
1986
+
1987
+ `user[name]` also creates `{ user: { name: ... } }`, while `items[]` creates an array.
1988
+
1989
+ Axios supports `postForm`, `putForm`, and `patchForm` as shortcuts for the matching HTTP methods with the `Content-Type` header preset to `multipart/form-data`.
1990
+
1991
+ ## Posting files
1992
+
1993
+ Submit a single file:
1994
+
1995
+ ```js
1996
+ await axios.postForm('https://httpbin.org/post', {
1997
+ myVar: 'foo',
1998
+ file: document.querySelector('#fileInput').files[0],
1999
+ });
2000
+ ```
2001
+
2002
+ or multiple files as `multipart/form-data`:
2003
+
2004
+ ```js
2005
+ await axios.postForm('https://httpbin.org/post', {
2006
+ 'files[]': document.querySelector('#fileInput').files,
2007
+ });
2008
+ ```
2009
+
2010
+ `FileList` object can be passed directly:
2011
+
2012
+ ```js
2013
+ await axios.postForm('https://httpbin.org/post', document.querySelector('#fileInput').files);
2014
+ ```
2015
+
2016
+ Axios sends all files with the same field name: `files[]`.
2017
+
2018
+ ## HTML form posting (browser)
2019
+
2020
+ Pass an HTML Form element as a payload to submit it as `multipart/form-data` content.
2021
+
2022
+ ```js
2023
+ await axios.postForm('https://httpbin.org/post', document.querySelector('#htmlForm'));
2024
+ ```
2025
+
2026
+ `FormData` and `HTMLForm` objects can also be posted as `JSON` by explicitly setting the `Content-Type` header to `application/json`:
2027
+
2028
+ ```js
2029
+ await axios.post('https://httpbin.org/post', document.querySelector('#htmlForm'), {
2030
+ headers: {
2031
+ 'Content-Type': 'application/json',
2032
+ },
2033
+ });
2034
+ ```
2035
+
2036
+ For example, the Form
2037
+
2038
+ ```html
2039
+ <form id="form">
2040
+ <input type="text" name="foo" value="1" />
2041
+ <input type="text" name="deep.prop" value="2" />
2042
+ <input type="text" name="deep prop spaced" value="3" />
2043
+ <input type="text" name="baz" value="4" />
2044
+ <input type="text" name="baz" value="5" />
2045
+
2046
+ <select name="user.age">
2047
+ <option value="value1">Value 1</option>
2048
+ <option value="value2" selected>Value 2</option>
2049
+ <option value="value3">Value 3</option>
2050
+ </select>
2051
+
2052
+ <input type="submit" value="Save" />
2053
+ </form>
2054
+ ```
2055
+
2056
+ submits this JSON object:
2057
+
2058
+ ```js
2059
+ {
2060
+ "foo": "1",
2061
+ "deep": {
2062
+ "prop": "2"
2063
+ },
2064
+ "deep prop spaced": "3",
2065
+ "baz": [
2066
+ "4",
2067
+ "5"
2068
+ ],
2069
+ "user": {
2070
+ "age": "value2"
2071
+ }
2072
+ }
2073
+ ```
2074
+
2075
+ Only dot and bracket notation create nested paths when a form is converted to JSON. Spaces and other punctuation remain part of literal field names.
2076
+
2077
+ Sending `Blobs`/`Files` as JSON (`base64`) is not currently supported.
2078
+
2079
+ ## Progress capturing
2080
+
2081
+ Axios can capture request upload and download progress in browsers and Node.js.
2082
+ Progress events are limited to `3` times per second.
2083
+
2084
+ ```js
2085
+ await axios.post(url, data, {
2086
+ onUploadProgress: function (axiosProgressEvent) {
2087
+ /*{
2088
+ loaded: number;
2089
+ total?: number;
2090
+ progress?: number; // in range [0..1]
2091
+ bytes: number; // how many bytes have been transferred since the last trigger (delta)
2092
+ estimated?: number; // estimated time in seconds
2093
+ rate?: number; // upload speed in bytes
2094
+ upload: true; // upload sign
2095
+ }*/
2096
+ },
2097
+
2098
+ onDownloadProgress: function (axiosProgressEvent) {
2099
+ /*{
2100
+ loaded: number;
2101
+ total?: number;
2102
+ progress?: number;
2103
+ bytes: number;
2104
+ estimated?: number;
2105
+ rate?: number; // download speed in bytes
2106
+ download: true; // download sign
2107
+ }*/
2108
+ },
2109
+ });
2110
+ ```
2111
+
2112
+ You can also track stream upload/download progress in node.js:
2113
+
2114
+ ```js
2115
+ const { data } = await axios.post(SERVER_URL, readableStream, {
2116
+ onUploadProgress: ({ progress }) => {
2117
+ console.log((progress * 100).toFixed(2));
2118
+ },
2119
+
2120
+ headers: {
2121
+ 'Content-Length': contentLength,
2122
+ },
2123
+
2124
+ maxRedirects: 0, // avoid buffering the entire stream
2125
+ });
2126
+ ```
2127
+
2128
+ > Note:
2129
+ > Capturing FormData upload progress is not currently supported in node.js environments.
2130
+
2131
+ > Warning:
2132
+ > Set `maxRedirects: 0` when uploading streams in node.js.
2133
+ > The follow-redirects package buffers the entire stream in RAM and does not follow the "backpressure" algorithm.
2134
+
2135
+ ## Rate limiting
2136
+
2137
+ Download and upload rate limits can only be set for the http adapter (node.js):
2138
+
2139
+ ```js
2140
+ const { data } = await axios.post(LOCAL_SERVER_URL, myBuffer, {
2141
+ onUploadProgress: ({ progress, rate }) => {
2142
+ console.log(`Upload [${(progress * 100).toFixed(2)}%]: ${(rate / 1024).toFixed(2)}KB/s`);
2143
+ },
2144
+
2145
+ maxRate: [100 * 1024], // 100KB/s limit
2146
+ });
2147
+ ```
2148
+
2149
+ ## AxiosHeaders
2150
+
2151
+ Axios includes an `AxiosHeaders` class for working with headers through a Map-like API.
2152
+ HTTP header names are case-insensitive, but Axios keeps the original header case for style and for servers that incorrectly depend on case.
2153
+ Directly manipulating the headers object still works, but it is deprecated.
2154
+
2155
+ ### Working with headers
2156
+
2157
+ An `AxiosHeaders` instance can contain several internal value types that control setting and merging.
2158
+ Axios gets the final headers object with string values by calling `toJSON`.
2159
+
2160
+ > Note: By JSON here we mean an object consisting only of string values intended to be sent over the network.
2161
+
2162
+ The header value can be one of the following types:
2163
+
2164
+ - `string` - normal string value sent to the server
2165
+ - `null` - skip header when rendering to JSON
2166
+ - `false` - skip header when rendering to JSON. Also indicates that the `set` method must be called with `rewrite` set to `true`
2167
+ to overwrite this value (Axios uses this internally to allow users to opt out of installing certain headers like `User-Agent` or `Content-Type`)
2168
+ - `undefined` - value is not set
2169
+
2170
+ > Note: The header value is considered set if it is not equal to undefined.
2171
+
2172
+ The headers object is always initialized inside interceptors and transformers:
2173
+
2174
+ ```ts
2175
+ axios.interceptors.request.use((request: InternalAxiosRequestConfig) => {
2176
+ request.headers.set('My-header', 'value');
2177
+
2178
+ request.headers.set({
2179
+ 'My-set-header1': 'my-set-value1',
2180
+ 'My-set-header2': 'my-set-value2',
2181
+ });
2182
+
2183
+ request.headers.set('User-Agent', false); // prevent Axios from setting this header later
2184
+
2185
+ request.headers.setContentType('text/plain');
2186
+
2187
+ request.headers['My-set-header2'] = 'newValue'; // direct access is deprecated
2188
+
2189
+ return request;
2190
+ });
2191
+ ```
2192
+
2193
+ You can iterate over an `AxiosHeaders` instance using a `for...of` statement:
2194
+
2195
+ ```js
2196
+ const headers = new AxiosHeaders({
2197
+ foo: '1',
2198
+ bar: '2',
2199
+ baz: '3',
2200
+ });
2201
+
2202
+ for (const [header, value] of headers) {
2203
+ console.log(header, value);
2204
+ }
2205
+
2206
+ // foo 1
2207
+ // bar 2
2208
+ // baz 3
2209
+ ```
2210
+
2211
+ ### Preserving a specific header case
2212
+
2213
+ Header names are case-insensitive, but `AxiosHeaders` keeps the case of the first matching key it sees.
2214
+ If you need a specific case for non-standard case-sensitive servers, define a case preset with `undefined` and then set the value later:
2215
+
2216
+ ```js
2217
+ const api = axios.create();
2218
+
2219
+ api.defaults.headers.common = {
2220
+ 'content-type': undefined,
2221
+ accept: undefined,
2222
+ };
2223
+
2224
+ await api.put(url, data, {
2225
+ headers: {
2226
+ 'Content-Type': 'application/octet-stream',
2227
+ Accept: 'application/json',
2228
+ },
2229
+ });
2230
+ ```
2231
+
2232
+ You can also compose the same behavior with `AxiosHeaders.concat`:
2233
+
2234
+ ```js
2235
+ const headers = axios.AxiosHeaders.concat(
2236
+ { 'content-type': undefined },
2237
+ { 'Content-Type': 'application/octet-stream' }
2238
+ );
2239
+
2240
+ await axios.put(url, data, { headers });
2241
+ ```
2242
+
2243
+ ### new AxiosHeaders(headers?)
2244
+
2245
+ Constructs a new `AxiosHeaders` instance.
2246
+
2247
+ ```
2248
+ constructor(headers?: RawAxiosHeaders | AxiosHeaders | string);
2249
+ ```
2250
+
2251
+ If the headers object is a string, Axios parses it as raw HTTP headers.
2252
+
2253
+ ```js
2254
+ const headers = new AxiosHeaders(`
2255
+ Host: www.bing.com
2256
+ User-Agent: curl/7.54.0
2257
+ Accept: */*`);
2258
+
2259
+ console.log(headers);
2260
+
2261
+ // Object [AxiosHeaders] {
2262
+ // host: 'www.bing.com',
2263
+ // 'user-agent': 'curl/7.54.0',
2264
+ // accept: '*/*'
2265
+ // }
2266
+ ```
2267
+
2268
+ ### AxiosHeaders#set
2269
+
2270
+ ```ts
2271
+ set(headerName, value: Axios, rewrite?: boolean);
2272
+ set(headerName, value, rewrite?: (this: AxiosHeaders, value: string, name: string, headers: RawAxiosHeaders) => boolean);
2273
+ set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean);
2274
+ set(headers?: Iterable<[string, AxiosHeaderValue]>, rewrite?: boolean);
2275
+ ```
2276
+
2277
+ The `rewrite` argument controls the overwriting behavior:
2278
+
2279
+ - `false` - do not overwrite if the header's value is set (is not `undefined`)
2280
+ - `undefined` (default) - overwrite the header unless its value is set to `false`
2281
+ - `true` - rewrite anyway
2282
+
2283
+ The option can also accept a user-defined function that determines whether to overwrite the value.
2284
+
2285
+ Empty or whitespace-only header names are ignored.
2286
+
2287
+ Iterable key/value pairs, such as a `Map`, are accepted:
2288
+
2289
+ ```js
2290
+ const headers = new AxiosHeaders();
2291
+
2292
+ headers.set(
2293
+ new Map([
2294
+ ['X-Trace-Id', 'abc123'],
2295
+ ['Accept', 'application/json'],
2296
+ ])
2297
+ );
2298
+ ```
2299
+
2300
+ Returns `this`.
2301
+
2302
+ ### AxiosHeaders#get(header)
2303
+
2304
+ ```
2305
+ get(headerName: string, parser: typeof AxiosHeaders.parseParameters): AxiosHeaderParameters;
2306
+ get(headerName: string, parser: RegExp): RegExpExecArray | null;
2307
+ get(headerName: string, matcher?: true | AxiosHeaderParser): AxiosHeaderValue;
2308
+ ```
2309
+
2310
+ Returns the internal value of the header. It can take an extra argument to parse the header's value with `RegExp.exec`,
2311
+ matcher function or internal key-value parser.
2312
+
2313
+ ```ts
2314
+ const headers = new AxiosHeaders({
2315
+ 'Content-Type': 'multipart/form-data; boundary=Asrf456BGe4h',
2316
+ });
2317
+
2318
+ console.log(headers.get('Content-Type'));
2319
+ // multipart/form-data; boundary=Asrf456BGe4h
2320
+
2321
+ console.log(headers.get('Content-Type', true)); // parse key-value pairs from a string separated with \s,;= delimiters:
2322
+ // [Object: null prototype] {
2323
+ // 'multipart/form-data': undefined,
2324
+ // boundary: 'Asrf456BGe4h'
2325
+ // }
2326
+
2327
+ const quotedHeaders = new AxiosHeaders({
2328
+ 'Content-Type': 'multipart/form-data; boundary="a,b"',
2329
+ });
2330
+
2331
+ console.log({
2332
+ ...quotedHeaders.get('Content-Type', AxiosHeaders.parseParameters),
2333
+ });
2334
+ // { boundary: 'a,b' }
2335
+
2336
+ console.log(
2337
+ headers.get('Content-Type', (value, name, headers) => {
2338
+ return String(value).replace(/a/g, 'ZZZ');
2339
+ })
2340
+ );
2341
+ // multipZZZrt/form-dZZZtZZZ; boundZZZry=Asrf456BGe4h
2342
+
2343
+ console.log(headers.get('Content-Type', /boundary=(\w+)/)?.[0]);
2344
+ // boundary=Asrf456BGe4h
2345
+ ```
2346
+
2347
+ `AxiosHeaders.parseParameters` is the opt-in parser for normalized HTTP parameter values. It returns a null-prototype map, matches parameter names case-insensitively, removes quoted-string delimiters, decodes escaped quotes and backslashes, preserves commas and semicolons inside quoted values, and removes only HTTP optional whitespace around unquoted values. It omits the unsafe keys `__proto__`, `constructor`, and `prototype`.
2348
+
2349
+ Passing `true` remains the legacy tokenizer and keeps its existing output for backward compatibility.
2350
+
2351
+ Returns the value of the header.
2352
+
2353
+ ### AxiosHeaders#has(header, matcher?)
2354
+
2355
+ ```
2356
+ has(header: string, matcher?: AxiosHeaderMatcher): boolean;
2357
+ ```
2358
+
2359
+ Returns `true` if the header is set (has no `undefined` value).
2360
+
2361
+ ### AxiosHeaders#delete(header, matcher?)
2362
+
2363
+ ```
2364
+ delete(header: string | string[], matcher?: AxiosHeaderMatcher): boolean;
2365
+ ```
2366
+
2367
+ Returns `true` if at least one header has been removed.
2368
+
2369
+ ### AxiosHeaders#clear(matcher?)
2370
+
2371
+ ```
2372
+ clear(matcher?: AxiosHeaderMatcher): boolean;
2373
+ ```
2374
+
2375
+ Removes all headers.
2376
+ Unlike the `delete` method matcher, this optional matcher matches the header name rather than the value.
2377
+
2378
+ ```ts
2379
+ const headers = new AxiosHeaders({
2380
+ foo: '1',
2381
+ 'x-foo': '2',
2382
+ 'x-bar': '3',
2383
+ });
2384
+
2385
+ console.log(headers.clear(/^x-/)); // true
2386
+
2387
+ console.log(headers.toJSON()); // [Object: null prototype] { foo: '1' }
2388
+ ```
2389
+
2390
+ Returns `true` if at least one header has been cleared.
2391
+
2392
+ ### AxiosHeaders#normalize(format);
2393
+
2394
+ If the headers object was changed directly, it can have duplicates with the same name but in different cases.
2395
+ This method normalizes the headers object by combining duplicate keys into one.
2396
+ Axios uses this method internally after calling each interceptor.
2397
+ Set `format` to true for converting header names to lowercase and capitalizing the initial letters (`cOntEnt-type` => `Content-Type`)
2398
+
2399
+ ```js
2400
+ const headers = new AxiosHeaders({
2401
+ foo: '1',
2402
+ });
2403
+
2404
+ headers.Foo = '2';
2405
+ headers.FOO = '3';
2406
+
2407
+ console.log(headers.toJSON()); // [Object: null prototype] { foo: '1', Foo: '2', FOO: '3' }
2408
+ console.log(headers.normalize().toJSON()); // [Object: null prototype] { foo: '3' }
2409
+ console.log(headers.normalize(true).toJSON()); // [Object: null prototype] { Foo: '3' }
2410
+ ```
2411
+
2412
+ Returns `this`.
2413
+
2414
+ ### AxiosHeaders#concat(...targets)
2415
+
2416
+ ```
2417
+ concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): AxiosHeaders;
2418
+ ```
2419
+
2420
+ Merges the instance with targets into a new `AxiosHeaders` instance. If the target is a string, Axios parses it as raw HTTP headers.
2421
+
2422
+ Returns a new `AxiosHeaders` instance.
2423
+
2424
+ ### AxiosHeaders#toJSON(asStrings?)
2425
+
2426
+ ```
2427
+ toJSON(asStrings: true): Record<string, string>;
2428
+ toJSON(asStrings?: false): Record<string, string | string[]>;
2429
+ ```
2430
+
2431
+ Resolves all internal header values into a new null prototype object.
2432
+ Set `asStrings` to true to resolve arrays as a string containing all elements, separated by commas.
2433
+
2434
+ ### AxiosHeaders#toString()
2435
+
2436
+ ```
2437
+ toString(): string;
2438
+ ```
2439
+
2440
+ Returns the headers as a CRLF-free HTTP header block, one `name: value` pair per line.
2441
+
2442
+ ### AxiosHeaders.from(thing?)
2443
+
2444
+ ```
2445
+ from(thing?: AxiosHeaders | RawAxiosHeaders | string): AxiosHeaders;
2446
+ ```
2447
+
2448
+ Returns a new `AxiosHeaders` instance created from the raw headers passed in,
2449
+ or returns the given headers object if it's already an `AxiosHeaders` instance.
2450
+
2451
+ ### AxiosHeaders.concat(...targets)
2452
+
2453
+ ```
2454
+ concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): AxiosHeaders;
2455
+ ```
2456
+
2457
+ Returns a new `AxiosHeaders` instance created by merging the target objects.
2458
+
2459
+ ### Shortcuts
2460
+
2461
+ The following shortcuts are available:
2462
+
2463
+ - `setContentType`, `getContentType`, `hasContentType`
2464
+
2465
+ - `setContentLength`, `getContentLength`, `hasContentLength`
2466
+
2467
+ - `setAccept`, `getAccept`, `hasAccept`
2468
+
2469
+ - `setUserAgent`, `getUserAgent`, `hasUserAgent`
2470
+
2471
+ - `setContentEncoding`, `getContentEncoding`, `hasContentEncoding`
2472
+
2473
+ ## Fetch adapter
2474
+
2475
+ 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.
2476
+ To use it by default, select it explicitly:
2477
+
2478
+ ```js
2479
+ const { data } = axios.get(url, {
2480
+ adapter: 'fetch', // by default ['xhr', 'http', 'fetch']
2481
+ });
2482
+ ```
2483
+
2484
+ You can create a separate instance for this:
2485
+
2486
+ ```js
2487
+ const fetchAxios = axios.create({
2488
+ adapter: 'fetch',
2489
+ });
2490
+
2491
+ const { data } = fetchAxios.get(url);
2492
+ ```
2493
+
2494
+ The adapter supports the same features as the `xhr` adapter, including upload and download progress capturing.
2495
+ It also supports response types such as `stream` and `formdata` when the environment supports them.
2496
+
2497
+ 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.
2498
+
2499
+ ### Custom fetch
2500
+
2501
+ Since `v1.12.0`, you can configure the fetch adapter to use a custom fetch API instead of environment globals.
2502
+ Pass a custom `fetch` function, `Request`, and `Response` constructors through `env` config.
2503
+ This helps in custom environments and app frameworks.
2504
+
2505
+ 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.
2506
+ 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.
2507
+
2508
+ > Note: Setting `Request` and `Response` to `null` prevents the fetch adapter from capturing upload and download progress.
2509
+
2510
+ Basic example:
2511
+
2512
+ ```js
2513
+ import customFetchFunction from 'customFetchModule';
2514
+
2515
+ const instance = axios.create({
2516
+ adapter: 'fetch',
2517
+ onDownloadProgress(e) {
2518
+ console.log('downloadProgress', e);
2519
+ },
2520
+ env: {
2521
+ fetch: customFetchFunction,
2522
+ Request: null, // undefined -> use the global constructor
2523
+ Response: null,
2524
+ },
2525
+ });
2526
+ ```
2527
+
2528
+ #### Using with Tauri
2529
+
2530
+ 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.
2531
+
2532
+ ```js
2533
+ import { fetch } from '@tauri-apps/plugin-http';
2534
+ import axios from 'axios';
2535
+
2536
+ const instance = axios.create({
2537
+ adapter: 'fetch',
2538
+ onDownloadProgress(e) {
2539
+ console.log('downloadProgress', e);
2540
+ },
2541
+ env: {
2542
+ fetch,
2543
+ },
2544
+ });
2545
+
2546
+ const { data } = await instance.get('https://google.com');
2547
+ ```
2548
+
2549
+ #### Using with SvelteKit
2550
+
2551
+ [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:
2552
+
2553
+ ```js
2554
+ export async function load({ fetch }) {
2555
+ const { data: post } = await axios.get('https://jsonplaceholder.typicode.com/posts/1', {
2556
+ adapter: 'fetch',
2557
+ env: {
2558
+ fetch,
2559
+ Request: null,
2560
+ Response: null,
2561
+ },
2562
+ });
2563
+
2564
+ return { post };
2565
+ }
2566
+ ```
2567
+
2568
+ #### HTTP/2 support
2569
+
2570
+ Axios supports HTTP/2 through the Node.js `http` adapter, introduced in v1.13.0.
2571
+
2572
+ 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.
2573
+
2574
+ Options like `httpVersion` and `http2Options` are adapter-specific and may not behave the same way in every environment.
2575
+
2576
+ Note: HTTP/2 redirects are currently not supported by the HTTP/2 adapter.
2577
+
2578
+ ```js
2579
+ const form = new FormData();
2580
+
2581
+ form.append('foo', '123');
2582
+
2583
+ const { data, headers, status } = await axios.post('https://httpbin.org/post', form, {
2584
+ onUploadProgress(e) {
2585
+ console.log('upload progress', e);
2586
+ },
2587
+ onDownloadProgress(e) {
2588
+ console.log('download progress', e);
2589
+ },
2590
+ responseType: 'arraybuffer',
2591
+ });
2592
+ ```
2593
+
2594
+ ## Semver
2595
+
2596
+ Axios follows [semver](https://semver.org/) since `v1.0.0`.
2597
+
2598
+ ## Promises
2599
+
2600
+ axios depends on a native ES6 Promise implementation to be [supported](https://caniuse.com/promises).
2601
+ If your environment doesn't support ES6 Promises, you can [polyfill](https://github.com/jakearchibald/es6-promise).
2602
+
2603
+ ## TypeScript
2604
+
2605
+ axios includes [TypeScript](https://typescriptlang.org) definitions and a type guard for axios errors.
2606
+
2607
+ ```typescript
2608
+ let user: User = null;
2609
+ try {
2610
+ const { data } = await axios.get('/user?ID=12345');
2611
+ user = data.userDetails;
2612
+ } catch (error) {
2613
+ if (axios.isAxiosError(error)) {
2614
+ handleAxiosError(error);
2615
+ } else {
2616
+ handleUnexpectedError(error);
2617
+ }
2618
+ }
2619
+ ```
2620
+
2621
+ Use `axios.isCancel<T>()` to narrow cancellation errors to `CanceledError<T>`:
2622
+
2623
+ ```typescript
2624
+ const controller = new AbortController();
2625
+
2626
+ try {
2627
+ await axios.get<User>('/user?ID=12345', { signal: controller.signal });
2628
+ } catch (error) {
2629
+ if (axios.isCancel<User>(error)) {
2630
+ handleCancellation(error);
2631
+ }
2632
+ }
2633
+ ```
2634
+
2635
+ ### Typing request data and query params
2636
+
2637
+ `AxiosRequestConfig<D = any, P = any>` uses `D` for the request body and `P` for query parameters. The params serializer receives the same `P`, and both types are preserved on the default response config:
2638
+
2639
+ ```typescript
2640
+ import axios, {
2641
+ type AxiosPromise,
2642
+ type AxiosRequestConfig,
2643
+ type InternalAxiosRequestConfig,
2644
+ } from 'axios';
2645
+
2646
+ interface RequestBody {
2647
+ includeArchived: boolean;
2648
+ }
2649
+
2650
+ interface SearchParams {
2651
+ query: string;
2652
+ page?: number;
2653
+ }
2654
+
2655
+ interface SearchResponse {
2656
+ results: string[];
2657
+ }
2658
+
2659
+ const config: AxiosRequestConfig<RequestBody, SearchParams> = {
2660
+ data: { includeArchived: false },
2661
+ params: { query: 'axios', page: 1 },
2662
+ paramsSerializer: (params) => `${params.query}:${params.page ?? 1}`,
2663
+ };
2664
+
2665
+ const response = await axios.get('/search', config);
2666
+ response.config.data; // RequestBody | undefined
2667
+ response.config.params; // SearchParams | undefined
2668
+
2669
+ const invalidConfig: AxiosRequestConfig<RequestBody, SearchParams> = {
2670
+ // @ts-expect-error `query` must be a string
2671
+ params: { query: 123 },
2672
+ };
2673
+
2674
+ const adapter = (
2675
+ adapterConfig: InternalAxiosRequestConfig<RequestBody, SearchParams>
2676
+ ): AxiosPromise<SearchResponse, RequestBody, SearchParams> =>
2677
+ Promise.resolve({
2678
+ data: { results: [] },
2679
+ status: 200,
2680
+ statusText: 'OK',
2681
+ headers: {},
2682
+ config: adapterConfig,
2683
+ });
2684
+ ```
2685
+
2686
+ The request methods place `P` last—`<T, R, D, P>`—so the existing response data (`T`), custom response (`R`), and request data (`D`) positions do not change. Explicit custom response types still determine the resolved value. `RawAxiosRequestConfig`, `InternalAxiosRequestConfig`, defaults, `AxiosResponse`, `AxiosPromise<T, D, P>`, `AxiosError`, `CanceledError`, callable instances, adapters, and `mergeConfig()` also carry `P`. The default is `any` for backward compatibility.
2687
+
2688
+ Use all three public error generics when cancellation narrowing must retain the response, request body, and params types:
2689
+
2690
+ ```typescript
2691
+ declare const error: unknown;
2692
+
2693
+ if (axios.isCancel<SearchResponse, RequestBody, SearchParams>(error)) {
2694
+ error.config?.data; // RequestBody | undefined
2695
+ error.config?.params; // SearchParams | undefined
2696
+ }
2697
+ ```
2698
+
2699
+ ### Symbol-keyed custom request config
2700
+
2701
+ Own enumerable symbol properties survive config merging, so module-augmented options can reach request interceptors and adapters:
2702
+
2703
+ ```typescript
2704
+ import axios from 'axios';
2705
+
2706
+ export const someFlag: unique symbol = Symbol(
2707
+ 'some flag used in request interceptor'
2708
+ );
2709
+
2710
+ declare module 'axios' {
2711
+ interface AxiosRequestConfig<D = any, P = any> {
2712
+ [someFlag]?: boolean;
2713
+ }
2714
+ }
2715
+
2716
+ axios.interceptors.request.use((config) => {
2717
+ if (config[someFlag]) {
2718
+ config.headers.set('X-Some-Flag', 'enabled');
2719
+ }
2720
+ return config;
2721
+ });
2722
+
2723
+ await axios.get('/users', { [someFlag]: true });
2724
+ ```
2725
+
2726
+ Only own enumerable symbol properties are copied; inherited and non-enumerable symbol properties are not.
2727
+
2728
+ Because axios publishes an ESM default export and a CJS `module.exports`, TypeScript has a few caveats.
2729
+ The recommended setting is `"moduleResolution": "node16"`, which is implied by `"module": "node16"`. This requires TypeScript 4.7 or greater.
2730
+ If you use ESM, your settings should be fine.
2731
+ If you compile TypeScript to CJS and can't use `"moduleResolution": "node 16"`, enable `esModuleInterop`.
2732
+ If you use TypeScript to type check CJS JavaScript code, your only option is to use `"moduleResolution": "node16"`.
2733
+
2734
+ You can also create a custom instance with typed interceptors:
2735
+
2736
+ ```typescript
2737
+ import axios, { AxiosInstance, InternalAxiosRequestConfig } from 'axios';
2738
+
2739
+ const apiClient: AxiosInstance = axios.create({
2740
+ baseURL: 'https://api.example.com',
2741
+ timeout: 10000,
2742
+ });
2743
+
2744
+ apiClient.interceptors.request.use((config: InternalAxiosRequestConfig) => {
2745
+ // Add auth token
2746
+ return config;
2747
+ });
2748
+ ```
2749
+
2750
+ ## Online one-click setup
2751
+
2752
+ You can use Gitpod, a free online IDE for open source projects, to contribute or run the examples online.
2753
+
2754
+ [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/axios/axios/blob/main/examples/server.js)
2755
+
2756
+ ## Contributing
2757
+
2758
+ ### Local setup
2759
+
2760
+ As a supply-chain hardening measure, this repository ships a project-level `.npmrc` that sets `ignore-scripts=true`. This blocks npm lifecycle scripts (`preinstall`, `install`, `postinstall`, `prepare`) from any direct or transitive dependency when you run `npm install` or `npm ci` inside the repo. See [THREATMODEL.md](./THREATMODEL.md) (threat T-S2) for the rationale.
2761
+
2762
+ One consequence: the repository's own `prepare` hook (which installs Husky's git hooks) will **not** run automatically. After your first install, enable the git hooks manually:
2763
+
2764
+ ```bash
2765
+ npm ci
2766
+ npm rebuild husky && npx husky
2767
+ ```
2768
+
2769
+ Run those two commands once per fresh checkout. You do **not** need to re-run them after every subsequent `npm install`.
2770
+
2771
+ 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.
2772
+
2773
+ ## Resources
2774
+
2775
+ - [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
2776
+ - [Ecosystem](https://github.com/axios/axios/blob/v1.x/ECOSYSTEM.md)
2777
+ - [Contributing Guide](https://github.com/axios/axios/blob/v1.x/CONTRIBUTING.md)
2778
+ - [Code of Conduct](https://github.com/axios/axios/blob/v1.x/CODE_OF_CONDUCT.md)
2779
+
2780
+ ## Credits
2781
+
2782
+ 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.
2783
+
2784
+ ## License
2785
+
2786
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)