@openclaw/slack 2026.7.2-beta.3 → 2026.7.2-beta.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 (627) hide show
  1. package/README.md +1 -1
  2. package/dist/account-inspect-api.js +1 -1
  3. package/dist/{account-inspect-Bvbtu3iH.js → account-inspect-jn1xLaVi.js} +2 -2
  4. package/dist/account-reply-mode-DrUXogvO.js +14 -0
  5. package/dist/{accounts-DQEbYKh9.js → accounts-BSr252c_.js} +6 -27
  6. package/dist/{accounts.runtime-BIKmJdtJ.js → accounts.runtime-CjULMLTa.js} +1 -1
  7. package/dist/{action-runtime-DqkRwO3Z.js → action-runtime-BO3HK_50.js} +7 -7
  8. package/dist/action-runtime.runtime-DbEcqEXC.js +2 -0
  9. package/dist/{actions-CF0tUY5q.js → actions-BkOaiDSX.js} +6 -6
  10. package/dist/{actions.runtime-hCbx4RXg.js → actions.runtime-Do-iOL51.js} +1 -1
  11. package/dist/api.js +15 -15
  12. package/dist/{approval-handler.runtime-Em8I1-8-.js → approval-handler.runtime-BAnGN7w0.js} +2 -2
  13. package/dist/{channel-4-TRi1D6.js → channel-Cnrlie9S.js} +26 -36
  14. package/dist/channel-config-api.js +1 -1
  15. package/dist/channel-plugin-api.js +1 -1
  16. package/dist/{channel-type-Cu1yjNg2.js → channel-type-CPDX8EV-.js} +4 -4
  17. package/dist/{channel.setup-CgkADtZg.js → channel.setup-DyZdLwUB.js} +6 -25
  18. package/dist/{setup-core-CeiAVwQ3.js → config-adapter-Bb8hn2tM.js} +141 -72
  19. package/dist/{config-schema-XjJGfwQC.js → config-schema-BajbuJGL.js} +229 -30
  20. package/dist/{directory-config-Bv0lcUlH.js → directory-config-CeixfVuC.js} +2 -2
  21. package/dist/directory-contract-api.js +1 -1
  22. package/dist/{directory-live-CzUIB7th.js → directory-live-CUwGPX2d.js} +3 -3
  23. package/dist/doctor-contract-CsGH1Dfc.js +158 -0
  24. package/dist/doctor-contract-api.js +1 -1
  25. package/dist/{group-policy-Bw-65m3V.js → group-policy-CthIXE2T.js} +48 -7
  26. package/dist/{message-tool-api-C2pcf5du.js → message-tool-api-CvKoWYYQ.js} +1 -6
  27. package/dist/message-tool-api.js +1 -1
  28. package/dist/{monitor-CNFeF30h.js → monitor-Cb5ZsOTY.js} +4 -4
  29. package/dist/{outbound-adapter-CVi2uok0.js → outbound-adapter-sGrozuRg.js} +11 -68
  30. package/dist/{pipeline.runtime-CTvokbty.js → pipeline.runtime-mFCCSllA.js} +2173 -1999
  31. package/dist/{policy-b_dOPDCq.js → policy-DVg6FyMP.js} +1 -1
  32. package/dist/{probe-Borhn9PQ.js → probe-BhQTDVBQ.js} +51 -58
  33. package/dist/{provider-B-HVL5ZE.js → provider-PSppCU_K.js} +435 -252
  34. package/dist/{relay-source-Ea_P9VcO.js → relay-source-D0mb_JBk.js} +1 -1
  35. package/dist/{replies-B4bOdrYb.js → replies-BkPPM2Ri.js} +50 -13
  36. package/dist/{resolve-channels-KTc568SU.js → resolve-channels-B3RlJKyV.js} +2 -2
  37. package/dist/{resolve-users-DeGJf1yp.js → resolve-users-DTm7PEMa.js} +2 -2
  38. package/dist/{rolldown-runtime-D7D4PA-g.js → rolldown-runtime-8H4AJuhK.js} +1 -0
  39. package/dist/{runtime-api-BFfNpzDe.js → runtime-api-jpn3vQ7e.js} +3 -2
  40. package/dist/runtime-api.js +11 -11
  41. package/dist/{scopes-lx08L56K.js → scopes-B2SqZ--4.js} +1 -1
  42. package/dist/{security-audit-CikQhBUY.js → security-audit-DR097212.js} +1 -11
  43. package/dist/security-contract-api.js +1 -1
  44. package/dist/{send-KuTDky7i.js → send-2IoDXPeB.js} +8 -22
  45. package/dist/{send.runtime-CXyxws1D.js → send.runtime-BKd_PAEw.js} +1 -1
  46. package/dist/setup-plugin-api.js +1 -1
  47. package/dist/{setup-surface-DLA0vHXp.js → setup-surface-Dyam58nO.js} +47 -39
  48. package/dist/{shared-C4yVB0Q-.js → shared-g55DV75U.js} +16 -37
  49. package/dist/{slash-dispatch.runtime-BT-mMm-f.js → slash-dispatch.runtime-BRQbvn2e.js} +10 -9
  50. package/node_modules/@slack/bolt/dist/App.d.ts +4 -19
  51. package/node_modules/@slack/bolt/dist/App.d.ts.map +1 -1
  52. package/node_modules/@slack/bolt/dist/App.js +21 -40
  53. package/node_modules/@slack/bolt/dist/App.js.map +1 -1
  54. package/node_modules/@slack/bolt/dist/context/create-respond.d.ts +3 -3
  55. package/node_modules/@slack/bolt/dist/context/create-respond.d.ts.map +1 -1
  56. package/node_modules/@slack/bolt/dist/context/create-respond.js +13 -2
  57. package/node_modules/@slack/bolt/dist/context/create-respond.js.map +1 -1
  58. package/node_modules/@slack/bolt/dist/errors.d.ts +6 -8
  59. package/node_modules/@slack/bolt/dist/errors.d.ts.map +1 -1
  60. package/node_modules/@slack/bolt/dist/errors.js +11 -11
  61. package/node_modules/@slack/bolt/dist/errors.js.map +1 -1
  62. package/node_modules/@slack/bolt/dist/helpers.d.ts.map +1 -1
  63. package/node_modules/@slack/bolt/dist/helpers.js +1 -2
  64. package/node_modules/@slack/bolt/dist/helpers.js.map +1 -1
  65. package/node_modules/@slack/bolt/dist/index.d.ts +0 -1
  66. package/node_modules/@slack/bolt/dist/index.d.ts.map +1 -1
  67. package/node_modules/@slack/bolt/dist/index.js +1 -3
  68. package/node_modules/@slack/bolt/dist/index.js.map +1 -1
  69. package/node_modules/@slack/bolt/dist/receivers/AwsLambdaReceiver.d.ts +10 -1
  70. package/node_modules/@slack/bolt/dist/receivers/AwsLambdaReceiver.d.ts.map +1 -1
  71. package/node_modules/@slack/bolt/dist/receivers/AwsLambdaReceiver.js +5 -1
  72. package/node_modules/@slack/bolt/dist/receivers/AwsLambdaReceiver.js.map +1 -1
  73. package/node_modules/@slack/bolt/dist/receivers/HTTPModuleFunctions.d.ts.map +1 -1
  74. package/node_modules/@slack/bolt/dist/receivers/HTTPModuleFunctions.js +10 -14
  75. package/node_modules/@slack/bolt/dist/receivers/HTTPModuleFunctions.js.map +1 -1
  76. package/node_modules/@slack/bolt/dist/receivers/SocketModeFunctions.d.ts.map +1 -1
  77. package/node_modules/@slack/bolt/dist/receivers/SocketModeFunctions.js +1 -1
  78. package/node_modules/@slack/bolt/dist/receivers/SocketModeFunctions.js.map +1 -1
  79. package/node_modules/@slack/bolt/dist/receivers/SocketModeReceiver.d.ts +3 -1
  80. package/node_modules/@slack/bolt/dist/receivers/SocketModeReceiver.d.ts.map +1 -1
  81. package/node_modules/@slack/bolt/dist/receivers/SocketModeReceiver.js +2 -1
  82. package/node_modules/@slack/bolt/dist/receivers/SocketModeReceiver.js.map +1 -1
  83. package/node_modules/@slack/bolt/dist/types/actions/index.d.ts +2 -4
  84. package/node_modules/@slack/bolt/dist/types/actions/index.d.ts.map +1 -1
  85. package/node_modules/@slack/bolt/dist/types/actions/index.js +0 -2
  86. package/node_modules/@slack/bolt/dist/types/actions/index.js.map +1 -1
  87. package/node_modules/@slack/bolt/dist/types/events/index.d.ts +2 -0
  88. package/node_modules/@slack/bolt/dist/types/events/index.d.ts.map +1 -1
  89. package/node_modules/@slack/bolt/dist/types/utilities.d.ts +2 -2
  90. package/node_modules/@slack/bolt/dist/types/utilities.d.ts.map +1 -1
  91. package/node_modules/@slack/bolt/dist/types/view/index.d.ts +1 -31
  92. package/node_modules/@slack/bolt/dist/types/view/index.d.ts.map +1 -1
  93. package/node_modules/@slack/bolt/package.json +10 -11
  94. package/node_modules/@slack/logger/README.md +1 -1
  95. package/node_modules/@slack/logger/dist/index.js +17 -13
  96. package/node_modules/@slack/logger/dist/index.js.map +1 -1
  97. package/node_modules/@slack/logger/package.json +6 -7
  98. package/node_modules/@slack/oauth/README.md +1 -1
  99. package/node_modules/@slack/oauth/dist/errors.d.ts +25 -14
  100. package/node_modules/@slack/oauth/dist/errors.d.ts.map +1 -1
  101. package/node_modules/@slack/oauth/dist/errors.js +24 -33
  102. package/node_modules/@slack/oauth/dist/errors.js.map +1 -1
  103. package/node_modules/@slack/oauth/dist/install-provider.js +58 -16
  104. package/node_modules/@slack/oauth/dist/install-provider.js.map +1 -1
  105. package/node_modules/@slack/oauth/dist/installation-stores/file-store.js +4 -2
  106. package/node_modules/@slack/oauth/dist/installation-stores/file-store.js.map +1 -1
  107. package/node_modules/@slack/oauth/dist/installation-stores/memory-store.js +3 -16
  108. package/node_modules/@slack/oauth/dist/installation-stores/memory-store.js.map +1 -1
  109. package/node_modules/@slack/oauth/dist/state-stores/clear-state-store.js +2 -0
  110. package/node_modules/@slack/oauth/dist/state-stores/clear-state-store.js.map +1 -1
  111. package/node_modules/@slack/oauth/dist/state-stores/file-state-store.js +3 -0
  112. package/node_modules/@slack/oauth/dist/state-stores/file-state-store.js.map +1 -1
  113. package/node_modules/@slack/oauth/package.json +8 -9
  114. package/node_modules/@slack/socket-mode/README.md +1 -1
  115. package/node_modules/@slack/socket-mode/dist/package.json +21 -13
  116. package/node_modules/@slack/socket-mode/dist/src/SlackWebSocket.d.ts +14 -8
  117. package/node_modules/@slack/socket-mode/dist/src/SlackWebSocket.d.ts.map +1 -1
  118. package/node_modules/@slack/socket-mode/dist/src/SlackWebSocket.js +136 -48
  119. package/node_modules/@slack/socket-mode/dist/src/SlackWebSocket.js.map +1 -1
  120. package/node_modules/@slack/socket-mode/dist/src/SocketModeClient.d.ts +12 -6
  121. package/node_modules/@slack/socket-mode/dist/src/SocketModeClient.d.ts.map +1 -1
  122. package/node_modules/@slack/socket-mode/dist/src/SocketModeClient.js +87 -38
  123. package/node_modules/@slack/socket-mode/dist/src/SocketModeClient.js.map +1 -1
  124. package/node_modules/@slack/socket-mode/dist/src/SocketModeOptions.d.ts +31 -1
  125. package/node_modules/@slack/socket-mode/dist/src/SocketModeOptions.d.ts.map +1 -1
  126. package/node_modules/@slack/socket-mode/dist/src/errors.d.ts +31 -37
  127. package/node_modules/@slack/socket-mode/dist/src/errors.d.ts.map +1 -1
  128. package/node_modules/@slack/socket-mode/dist/src/errors.js +43 -47
  129. package/node_modules/@slack/socket-mode/dist/src/errors.js.map +1 -1
  130. package/node_modules/@slack/socket-mode/dist/src/index.d.ts +2 -2
  131. package/node_modules/@slack/socket-mode/dist/src/index.d.ts.map +1 -1
  132. package/node_modules/@slack/socket-mode/dist/src/index.js +7 -1
  133. package/node_modules/@slack/socket-mode/dist/src/index.js.map +1 -1
  134. package/node_modules/@slack/socket-mode/package.json +21 -13
  135. package/node_modules/@slack/types/README.md +1 -1
  136. package/node_modules/@slack/types/dist/events/app.d.ts +28 -0
  137. package/node_modules/@slack/types/dist/events/app.d.ts.map +1 -1
  138. package/node_modules/@slack/types/dist/events/index.d.ts +2 -2
  139. package/node_modules/@slack/types/dist/events/index.d.ts.map +1 -1
  140. package/node_modules/@slack/types/dist/events/index.js.map +1 -1
  141. package/node_modules/@slack/types/dist/events/message.d.ts +2 -0
  142. package/node_modules/@slack/types/dist/events/message.d.ts.map +1 -1
  143. package/node_modules/@slack/types/package.json +3 -3
  144. package/node_modules/@slack/web-api/README.md +1 -1
  145. package/node_modules/@slack/web-api/dist/WebClient.d.ts +42 -71
  146. package/node_modules/@slack/web-api/dist/WebClient.d.ts.map +1 -1
  147. package/node_modules/@slack/web-api/dist/WebClient.js +180 -248
  148. package/node_modules/@slack/web-api/dist/WebClient.js.map +1 -1
  149. package/node_modules/@slack/web-api/dist/chat-stream.js +37 -22
  150. package/node_modules/@slack/web-api/dist/chat-stream.js.map +1 -1
  151. package/node_modules/@slack/web-api/dist/errors.d.ts +32 -51
  152. package/node_modules/@slack/web-api/dist/errors.d.ts.map +1 -1
  153. package/node_modules/@slack/web-api/dist/errors.js +64 -55
  154. package/node_modules/@slack/web-api/dist/errors.js.map +1 -1
  155. package/node_modules/@slack/web-api/dist/file-upload.d.ts +0 -9
  156. package/node_modules/@slack/web-api/dist/file-upload.d.ts.map +1 -1
  157. package/node_modules/@slack/web-api/dist/file-upload.js +41 -46
  158. package/node_modules/@slack/web-api/dist/file-upload.js.map +1 -1
  159. package/node_modules/@slack/web-api/dist/index.d.ts +2 -2
  160. package/node_modules/@slack/web-api/dist/index.d.ts.map +1 -1
  161. package/node_modules/@slack/web-api/dist/index.js +8 -1
  162. package/node_modules/@slack/web-api/dist/index.js.map +1 -1
  163. package/node_modules/@slack/web-api/dist/methods.d.ts +2 -38
  164. package/node_modules/@slack/web-api/dist/methods.d.ts.map +1 -1
  165. package/node_modules/@slack/web-api/dist/methods.js +1347 -1384
  166. package/node_modules/@slack/web-api/dist/methods.js.map +1 -1
  167. package/node_modules/@slack/web-api/dist/types/request/files.d.ts +0 -1
  168. package/node_modules/@slack/web-api/dist/types/request/files.d.ts.map +1 -1
  169. package/node_modules/@slack/web-api/dist/types/request/index.d.ts +3 -3
  170. package/node_modules/@slack/web-api/dist/types/request/index.d.ts.map +1 -1
  171. package/node_modules/@slack/web-api/dist/types/request/manifest.d.ts +66 -1
  172. package/node_modules/@slack/web-api/dist/types/request/manifest.d.ts.map +1 -1
  173. package/node_modules/@slack/web-api/dist/types/request/rtm.d.ts +1 -14
  174. package/node_modules/@slack/web-api/dist/types/request/rtm.d.ts.map +1 -1
  175. package/node_modules/@slack/web-api/dist/types/request/workflows.d.ts +0 -29
  176. package/node_modules/@slack/web-api/dist/types/request/workflows.d.ts.map +1 -1
  177. package/node_modules/@slack/web-api/package.json +6 -10
  178. package/node_modules/@types/node/README.md +1 -1
  179. package/node_modules/@types/node/fs/promises.d.ts +16 -6
  180. package/node_modules/@types/node/package.json +2 -2
  181. package/node_modules/@types/retry/LICENSE +21 -21
  182. package/node_modules/@types/retry/README.md +5 -4
  183. package/node_modules/@types/retry/index.d.ts +20 -13
  184. package/node_modules/@types/retry/package.json +9 -11
  185. package/node_modules/iconv-lite/encodings/sbcs-data.js +2 -0
  186. package/node_modules/iconv-lite/encodings/utf32.js +10 -3
  187. package/node_modules/iconv-lite/package.json +2 -2
  188. package/node_modules/iconv-lite/types/encodings.d.ts +2 -0
  189. package/node_modules/path-to-regexp/Readme.md +3 -3
  190. package/node_modules/path-to-regexp/dist/index.js +135 -158
  191. package/node_modules/path-to-regexp/dist/index.js.map +1 -1
  192. package/node_modules/path-to-regexp/package.json +2 -2
  193. package/node_modules/qs/CHANGELOG.md +11 -0
  194. package/node_modules/qs/dist/qs.js +17 -17
  195. package/node_modules/qs/lib/parse.js +19 -8
  196. package/node_modules/qs/lib/utils.js +47 -8
  197. package/node_modules/qs/package.json +6 -5
  198. package/node_modules/qs/test/parse.js +230 -0
  199. package/node_modules/qs/test/utils.js +194 -0
  200. package/node_modules/typebox/build/compile/validator.d.mts +1 -4
  201. package/node_modules/typebox/build/guard/guard.d.mts +1 -1
  202. package/node_modules/typebox/build/guard/guard.mjs +5 -2
  203. package/node_modules/typebox/build/guard/string.mjs +16 -4
  204. package/node_modules/typebox/build/schema/engine/_functions.mjs +34 -15
  205. package/node_modules/typebox/build/type/action/readonly_object.d.mts +5 -0
  206. package/node_modules/typebox/build/type/action/readonly_object.mjs +8 -0
  207. package/node_modules/typebox/build/typebox.d.mts +1 -1
  208. package/node_modules/typebox/build/typebox.mjs +1 -1
  209. package/node_modules/typebox/package.json +1 -1
  210. package/node_modules/typebox/readme.md +29 -32
  211. package/node_modules/{es-set-tostringtag → undici}/LICENSE +1 -1
  212. package/node_modules/undici/README.md +741 -0
  213. package/node_modules/undici/docs/docs/api/Agent.md +84 -0
  214. package/node_modules/undici/docs/docs/api/BalancedPool.md +99 -0
  215. package/node_modules/undici/docs/docs/api/CacheStorage.md +30 -0
  216. package/node_modules/undici/docs/docs/api/CacheStore.md +164 -0
  217. package/node_modules/undici/docs/docs/api/Client.md +288 -0
  218. package/node_modules/undici/docs/docs/api/ClientStats.md +27 -0
  219. package/node_modules/undici/docs/docs/api/Connector.md +115 -0
  220. package/node_modules/undici/docs/docs/api/ContentType.md +57 -0
  221. package/node_modules/undici/docs/docs/api/Cookies.md +128 -0
  222. package/node_modules/undici/docs/docs/api/Debug.md +62 -0
  223. package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +315 -0
  224. package/node_modules/undici/docs/docs/api/Dispatcher.md +1392 -0
  225. package/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +159 -0
  226. package/node_modules/undici/docs/docs/api/Errors.md +49 -0
  227. package/node_modules/undici/docs/docs/api/EventSource.md +45 -0
  228. package/node_modules/undici/docs/docs/api/Fetch.md +60 -0
  229. package/node_modules/undici/docs/docs/api/GlobalInstallation.md +139 -0
  230. package/node_modules/undici/docs/docs/api/H2CClient.md +263 -0
  231. package/node_modules/undici/docs/docs/api/MockAgent.md +603 -0
  232. package/node_modules/undici/docs/docs/api/MockCallHistory.md +197 -0
  233. package/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +43 -0
  234. package/node_modules/undici/docs/docs/api/MockClient.md +81 -0
  235. package/node_modules/undici/docs/docs/api/MockErrors.md +12 -0
  236. package/node_modules/undici/docs/docs/api/MockPool.md +555 -0
  237. package/node_modules/undici/docs/docs/api/Pool.md +84 -0
  238. package/node_modules/undici/docs/docs/api/PoolStats.md +35 -0
  239. package/node_modules/undici/docs/docs/api/ProxyAgent.md +229 -0
  240. package/node_modules/undici/docs/docs/api/RedirectHandler.md +93 -0
  241. package/node_modules/undici/docs/docs/api/RetryAgent.md +50 -0
  242. package/node_modules/undici/docs/docs/api/RetryHandler.md +118 -0
  243. package/node_modules/undici/docs/docs/api/RoundRobinPool.md +145 -0
  244. package/node_modules/undici/docs/docs/api/SnapshotAgent.md +616 -0
  245. package/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +275 -0
  246. package/node_modules/undici/docs/docs/api/Util.md +25 -0
  247. package/node_modules/undici/docs/docs/api/WebSocket.md +141 -0
  248. package/node_modules/undici/docs/docs/api/api-lifecycle.md +91 -0
  249. package/node_modules/undici/docs/docs/best-practices/client-certificate.md +64 -0
  250. package/node_modules/undici/docs/docs/best-practices/crawling.md +58 -0
  251. package/node_modules/undici/docs/docs/best-practices/mocking-request.md +190 -0
  252. package/node_modules/undici/docs/docs/best-practices/proxy.md +127 -0
  253. package/node_modules/undici/docs/docs/best-practices/undici-vs-builtin-fetch.md +224 -0
  254. package/node_modules/undici/docs/docs/best-practices/writing-tests.md +63 -0
  255. package/node_modules/undici/index-fetch.js +65 -0
  256. package/node_modules/undici/index.d.ts +3 -0
  257. package/node_modules/undici/index.js +234 -0
  258. package/node_modules/undici/lib/api/abort-signal.js +59 -0
  259. package/node_modules/undici/lib/api/api-connect.js +110 -0
  260. package/node_modules/undici/lib/api/api-pipeline.js +252 -0
  261. package/node_modules/undici/lib/api/api-request.js +214 -0
  262. package/node_modules/undici/lib/api/api-stream.js +209 -0
  263. package/node_modules/undici/lib/api/api-upgrade.js +111 -0
  264. package/node_modules/undici/lib/api/index.js +7 -0
  265. package/node_modules/undici/lib/api/readable.js +580 -0
  266. package/node_modules/undici/lib/cache/memory-cache-store.js +234 -0
  267. package/node_modules/undici/lib/cache/sqlite-cache-store.js +461 -0
  268. package/node_modules/undici/lib/core/connect.js +153 -0
  269. package/node_modules/undici/lib/core/constants.js +143 -0
  270. package/node_modules/undici/lib/core/diagnostics.js +227 -0
  271. package/node_modules/undici/lib/core/errors.js +477 -0
  272. package/node_modules/undici/lib/core/request.js +453 -0
  273. package/node_modules/undici/lib/core/socks5-client.js +422 -0
  274. package/node_modules/undici/lib/core/socks5-utils.js +212 -0
  275. package/node_modules/undici/lib/core/symbols.js +75 -0
  276. package/node_modules/undici/lib/core/tree.js +160 -0
  277. package/node_modules/undici/lib/core/util.js +992 -0
  278. package/node_modules/undici/lib/dispatcher/agent.js +158 -0
  279. package/node_modules/undici/lib/dispatcher/balanced-pool.js +219 -0
  280. package/node_modules/undici/lib/dispatcher/client-h1.js +1722 -0
  281. package/node_modules/undici/lib/dispatcher/client-h2.js +995 -0
  282. package/node_modules/undici/lib/dispatcher/client.js +664 -0
  283. package/node_modules/undici/lib/dispatcher/dispatcher-base.js +184 -0
  284. package/node_modules/undici/lib/dispatcher/dispatcher.js +48 -0
  285. package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +146 -0
  286. package/node_modules/undici/lib/dispatcher/fixed-queue.js +135 -0
  287. package/node_modules/undici/lib/dispatcher/h2c-client.js +51 -0
  288. package/node_modules/undici/lib/dispatcher/pool-base.js +214 -0
  289. package/node_modules/undici/lib/dispatcher/pool.js +118 -0
  290. package/node_modules/undici/lib/dispatcher/proxy-agent.js +319 -0
  291. package/node_modules/undici/lib/dispatcher/retry-agent.js +35 -0
  292. package/node_modules/undici/lib/dispatcher/round-robin-pool.js +137 -0
  293. package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +260 -0
  294. package/node_modules/undici/lib/encoding/index.js +33 -0
  295. package/node_modules/undici/lib/global.js +59 -0
  296. package/node_modules/undici/lib/handler/cache-handler.js +578 -0
  297. package/node_modules/undici/lib/handler/cache-revalidation-handler.js +124 -0
  298. package/node_modules/undici/lib/handler/decorator-handler.js +67 -0
  299. package/node_modules/undici/lib/handler/deduplication-handler.js +460 -0
  300. package/node_modules/undici/lib/handler/redirect-handler.js +238 -0
  301. package/node_modules/undici/lib/handler/retry-handler.js +394 -0
  302. package/node_modules/undici/lib/handler/unwrap-handler.js +106 -0
  303. package/node_modules/undici/lib/handler/wrap-handler.js +105 -0
  304. package/node_modules/undici/lib/interceptor/cache.js +495 -0
  305. package/node_modules/undici/lib/interceptor/decompress.js +259 -0
  306. package/node_modules/undici/lib/interceptor/deduplicate.js +117 -0
  307. package/node_modules/undici/lib/interceptor/dns.js +571 -0
  308. package/node_modules/undici/lib/interceptor/dump.js +112 -0
  309. package/node_modules/undici/lib/interceptor/redirect.js +21 -0
  310. package/node_modules/undici/lib/interceptor/response-error.js +95 -0
  311. package/node_modules/undici/lib/interceptor/retry.js +19 -0
  312. package/node_modules/undici/lib/llhttp/.gitkeep +0 -0
  313. package/node_modules/undici/lib/llhttp/constants.d.ts +195 -0
  314. package/node_modules/undici/lib/llhttp/constants.js +531 -0
  315. package/node_modules/undici/lib/llhttp/llhttp-wasm.js +15 -0
  316. package/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +15 -0
  317. package/node_modules/undici/lib/llhttp/utils.d.ts +2 -0
  318. package/node_modules/undici/lib/llhttp/utils.js +12 -0
  319. package/node_modules/undici/lib/mock/mock-agent.js +232 -0
  320. package/node_modules/undici/lib/mock/mock-call-history.js +248 -0
  321. package/node_modules/undici/lib/mock/mock-client.js +68 -0
  322. package/node_modules/undici/lib/mock/mock-errors.js +29 -0
  323. package/node_modules/undici/lib/mock/mock-interceptor.js +209 -0
  324. package/node_modules/undici/lib/mock/mock-pool.js +68 -0
  325. package/node_modules/undici/lib/mock/mock-symbols.js +32 -0
  326. package/node_modules/undici/lib/mock/mock-utils.js +486 -0
  327. package/node_modules/undici/lib/mock/pending-interceptors-formatter.js +43 -0
  328. package/node_modules/undici/lib/mock/snapshot-agent.js +353 -0
  329. package/node_modules/undici/lib/mock/snapshot-recorder.js +588 -0
  330. package/node_modules/undici/lib/mock/snapshot-utils.js +158 -0
  331. package/node_modules/undici/lib/util/cache.js +414 -0
  332. package/node_modules/undici/lib/util/date.js +653 -0
  333. package/node_modules/undici/lib/util/promise.js +28 -0
  334. package/node_modules/undici/lib/util/runtime-features.js +124 -0
  335. package/node_modules/undici/lib/util/stats.js +32 -0
  336. package/node_modules/undici/lib/util/timers.js +425 -0
  337. package/node_modules/undici/lib/web/cache/cache.js +864 -0
  338. package/node_modules/undici/lib/web/cache/cachestorage.js +152 -0
  339. package/node_modules/undici/lib/web/cache/util.js +45 -0
  340. package/node_modules/undici/lib/web/cookies/constants.js +12 -0
  341. package/node_modules/undici/lib/web/cookies/index.js +199 -0
  342. package/node_modules/undici/lib/web/cookies/parse.js +314 -0
  343. package/node_modules/undici/lib/web/cookies/util.js +282 -0
  344. package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +399 -0
  345. package/node_modules/undici/lib/web/eventsource/eventsource.js +501 -0
  346. package/node_modules/undici/lib/web/eventsource/util.js +29 -0
  347. package/node_modules/{has-tostringtag → undici/lib/web/fetch}/LICENSE +1 -1
  348. package/node_modules/undici/lib/web/fetch/body.js +509 -0
  349. package/node_modules/undici/lib/web/fetch/constants.js +131 -0
  350. package/node_modules/undici/lib/web/fetch/data-url.js +596 -0
  351. package/node_modules/undici/lib/web/fetch/formdata-parser.js +586 -0
  352. package/node_modules/undici/lib/web/fetch/formdata.js +259 -0
  353. package/node_modules/undici/lib/web/fetch/global.js +40 -0
  354. package/node_modules/undici/lib/web/fetch/headers.js +719 -0
  355. package/node_modules/undici/lib/web/fetch/index.js +2413 -0
  356. package/node_modules/undici/lib/web/fetch/request.js +1115 -0
  357. package/node_modules/undici/lib/web/fetch/response.js +641 -0
  358. package/node_modules/undici/lib/web/fetch/util.js +1522 -0
  359. package/node_modules/undici/lib/web/infra/index.js +229 -0
  360. package/node_modules/undici/lib/web/subresource-integrity/Readme.md +9 -0
  361. package/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +307 -0
  362. package/node_modules/undici/lib/web/webidl/index.js +1006 -0
  363. package/node_modules/undici/lib/web/websocket/connection.js +329 -0
  364. package/node_modules/undici/lib/web/websocket/constants.js +126 -0
  365. package/node_modules/undici/lib/web/websocket/events.js +331 -0
  366. package/node_modules/undici/lib/web/websocket/frame.js +133 -0
  367. package/node_modules/undici/lib/web/websocket/permessage-deflate.js +100 -0
  368. package/node_modules/undici/lib/web/websocket/receiver.js +507 -0
  369. package/node_modules/undici/lib/web/websocket/sender.js +109 -0
  370. package/node_modules/undici/lib/web/websocket/stream/websocketerror.js +104 -0
  371. package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +498 -0
  372. package/node_modules/undici/lib/web/websocket/util.js +347 -0
  373. package/node_modules/undici/lib/web/websocket/websocket.js +758 -0
  374. package/node_modules/undici/package.json +152 -0
  375. package/node_modules/undici/scripts/strip-comments.js +10 -0
  376. package/node_modules/undici/types/README.md +6 -0
  377. package/node_modules/undici/types/agent.d.ts +32 -0
  378. package/node_modules/undici/types/api.d.ts +43 -0
  379. package/node_modules/undici/types/balanced-pool.d.ts +30 -0
  380. package/node_modules/undici/types/cache-interceptor.d.ts +179 -0
  381. package/node_modules/undici/types/cache.d.ts +36 -0
  382. package/node_modules/undici/types/client-stats.d.ts +15 -0
  383. package/node_modules/undici/types/client.d.ts +139 -0
  384. package/node_modules/undici/types/connector.d.ts +36 -0
  385. package/node_modules/undici/types/content-type.d.ts +21 -0
  386. package/node_modules/undici/types/cookies.d.ts +30 -0
  387. package/node_modules/undici/types/diagnostics-channel.d.ts +74 -0
  388. package/node_modules/undici/types/dispatcher.d.ts +275 -0
  389. package/node_modules/undici/types/env-http-proxy-agent.d.ts +22 -0
  390. package/node_modules/undici/types/errors.d.ts +177 -0
  391. package/node_modules/undici/types/eventsource.d.ts +66 -0
  392. package/node_modules/undici/types/fetch.d.ts +231 -0
  393. package/node_modules/undici/types/formdata.d.ts +114 -0
  394. package/node_modules/undici/types/global-dispatcher.d.ts +9 -0
  395. package/node_modules/undici/types/global-origin.d.ts +7 -0
  396. package/node_modules/undici/types/h2c-client.d.ts +73 -0
  397. package/node_modules/undici/types/handlers.d.ts +14 -0
  398. package/node_modules/undici/types/header.d.ts +160 -0
  399. package/node_modules/undici/types/index.d.ts +91 -0
  400. package/node_modules/undici/types/interceptors.d.ts +80 -0
  401. package/node_modules/undici/types/mock-agent.d.ts +68 -0
  402. package/node_modules/undici/types/mock-call-history.d.ts +111 -0
  403. package/node_modules/undici/types/mock-client.d.ts +27 -0
  404. package/node_modules/undici/types/mock-errors.d.ts +12 -0
  405. package/node_modules/undici/types/mock-interceptor.d.ts +94 -0
  406. package/node_modules/undici/types/mock-pool.d.ts +27 -0
  407. package/node_modules/undici/types/patch.d.ts +29 -0
  408. package/node_modules/undici/types/pool-stats.d.ts +19 -0
  409. package/node_modules/undici/types/pool.d.ts +41 -0
  410. package/node_modules/undici/types/proxy-agent.d.ts +29 -0
  411. package/node_modules/undici/types/readable.d.ts +68 -0
  412. package/node_modules/undici/types/retry-agent.d.ts +8 -0
  413. package/node_modules/undici/types/retry-handler.d.ts +125 -0
  414. package/node_modules/undici/types/round-robin-pool.d.ts +41 -0
  415. package/node_modules/undici/types/snapshot-agent.d.ts +109 -0
  416. package/node_modules/undici/types/socks5-proxy-agent.d.ts +25 -0
  417. package/node_modules/undici/types/util.d.ts +18 -0
  418. package/node_modules/undici/types/utility.d.ts +7 -0
  419. package/node_modules/undici/types/webidl.d.ts +347 -0
  420. package/node_modules/undici/types/websocket.d.ts +188 -0
  421. package/node_modules/ws/lib/receiver.js +15 -32
  422. package/node_modules/ws/lib/websocket-server.js +4 -4
  423. package/node_modules/ws/lib/websocket.js +4 -4
  424. package/node_modules/ws/package.json +5 -1
  425. package/openclaw.plugin.json +1064 -1243
  426. package/package.json +99 -18
  427. package/dist/action-runtime.runtime-DEWOcFM4.js +0 -2
  428. package/dist/config-api-Df9a1B8C.js +0 -3
  429. package/dist/doctor-contract-DKpe5VBr.js +0 -202
  430. package/dist/interactive-replies-Dm_t2R9S.js +0 -197
  431. package/dist/interactive-replies-api.js +0 -2
  432. package/node_modules/@slack/bolt/dist/WorkflowStep.d.ts +0 -159
  433. package/node_modules/@slack/bolt/dist/WorkflowStep.d.ts.map +0 -1
  434. package/node_modules/@slack/bolt/dist/WorkflowStep.js +0 -217
  435. package/node_modules/@slack/bolt/dist/WorkflowStep.js.map +0 -1
  436. package/node_modules/@slack/bolt/dist/types/actions/workflow-step-edit.d.ts +0 -49
  437. package/node_modules/@slack/bolt/dist/types/actions/workflow-step-edit.d.ts.map +0 -1
  438. package/node_modules/@slack/bolt/dist/types/actions/workflow-step-edit.js +0 -3
  439. package/node_modules/@slack/bolt/dist/types/actions/workflow-step-edit.js.map +0 -1
  440. package/node_modules/@types/ws/LICENSE +0 -21
  441. package/node_modules/@types/ws/README.md +0 -15
  442. package/node_modules/@types/ws/index.d.mts +0 -451
  443. package/node_modules/@types/ws/index.d.ts +0 -445
  444. package/node_modules/@types/ws/package.json +0 -72
  445. package/node_modules/asynckit/LICENSE +0 -21
  446. package/node_modules/asynckit/README.md +0 -233
  447. package/node_modules/asynckit/bench.js +0 -76
  448. package/node_modules/asynckit/index.js +0 -6
  449. package/node_modules/asynckit/lib/abort.js +0 -29
  450. package/node_modules/asynckit/lib/async.js +0 -34
  451. package/node_modules/asynckit/lib/defer.js +0 -26
  452. package/node_modules/asynckit/lib/iterate.js +0 -75
  453. package/node_modules/asynckit/lib/readable_asynckit.js +0 -91
  454. package/node_modules/asynckit/lib/readable_parallel.js +0 -25
  455. package/node_modules/asynckit/lib/readable_serial.js +0 -25
  456. package/node_modules/asynckit/lib/readable_serial_ordered.js +0 -29
  457. package/node_modules/asynckit/lib/state.js +0 -37
  458. package/node_modules/asynckit/lib/streamify.js +0 -141
  459. package/node_modules/asynckit/lib/terminator.js +0 -29
  460. package/node_modules/asynckit/package.json +0 -63
  461. package/node_modules/asynckit/parallel.js +0 -43
  462. package/node_modules/asynckit/serial.js +0 -17
  463. package/node_modules/asynckit/serialOrdered.js +0 -75
  464. package/node_modules/asynckit/stream.js +0 -21
  465. package/node_modules/axios/CHANGELOG.md +0 -1676
  466. package/node_modules/axios/LICENSE +0 -7
  467. package/node_modules/axios/MIGRATION_GUIDE.md +0 -877
  468. package/node_modules/axios/README.md +0 -2391
  469. package/node_modules/axios/dist/axios.js +0 -4864
  470. package/node_modules/axios/dist/axios.js.map +0 -1
  471. package/node_modules/axios/dist/axios.min.js +0 -5
  472. package/node_modules/axios/dist/axios.min.js.map +0 -1
  473. package/node_modules/axios/dist/browser/axios.cjs +0 -4701
  474. package/node_modules/axios/dist/browser/axios.cjs.map +0 -1
  475. package/node_modules/axios/dist/esm/axios.js +0 -4722
  476. package/node_modules/axios/dist/esm/axios.js.map +0 -1
  477. package/node_modules/axios/dist/esm/axios.min.js +0 -3
  478. package/node_modules/axios/dist/esm/axios.min.js.map +0 -1
  479. package/node_modules/axios/dist/node/axios.cjs +0 -5348
  480. package/node_modules/axios/dist/node/axios.cjs.map +0 -1
  481. package/node_modules/axios/index.d.cts +0 -715
  482. package/node_modules/axios/index.d.ts +0 -734
  483. package/node_modules/axios/index.js +0 -45
  484. package/node_modules/axios/lib/adapters/README.md +0 -36
  485. package/node_modules/axios/lib/adapters/adapters.js +0 -132
  486. package/node_modules/axios/lib/adapters/fetch.js +0 -469
  487. package/node_modules/axios/lib/adapters/http.js +0 -1202
  488. package/node_modules/axios/lib/adapters/xhr.js +0 -226
  489. package/node_modules/axios/lib/axios.js +0 -89
  490. package/node_modules/axios/lib/cancel/CancelToken.js +0 -135
  491. package/node_modules/axios/lib/cancel/CanceledError.js +0 -22
  492. package/node_modules/axios/lib/cancel/isCancel.js +0 -5
  493. package/node_modules/axios/lib/core/Axios.js +0 -281
  494. package/node_modules/axios/lib/core/AxiosError.js +0 -176
  495. package/node_modules/axios/lib/core/AxiosHeaders.js +0 -380
  496. package/node_modules/axios/lib/core/InterceptorManager.js +0 -72
  497. package/node_modules/axios/lib/core/README.md +0 -8
  498. package/node_modules/axios/lib/core/buildFullPath.js +0 -22
  499. package/node_modules/axios/lib/core/dispatchRequest.js +0 -89
  500. package/node_modules/axios/lib/core/mergeConfig.js +0 -124
  501. package/node_modules/axios/lib/core/settle.js +0 -27
  502. package/node_modules/axios/lib/core/transformData.js +0 -28
  503. package/node_modules/axios/lib/defaults/index.js +0 -177
  504. package/node_modules/axios/lib/defaults/transitional.js +0 -8
  505. package/node_modules/axios/lib/env/README.md +0 -3
  506. package/node_modules/axios/lib/env/classes/FormData.js +0 -2
  507. package/node_modules/axios/lib/env/data.js +0 -1
  508. package/node_modules/axios/lib/helpers/AxiosTransformStream.js +0 -156
  509. package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +0 -61
  510. package/node_modules/axios/lib/helpers/HttpStatusCode.js +0 -77
  511. package/node_modules/axios/lib/helpers/README.md +0 -7
  512. package/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js +0 -29
  513. package/node_modules/axios/lib/helpers/bind.js +0 -14
  514. package/node_modules/axios/lib/helpers/buildURL.js +0 -66
  515. package/node_modules/axios/lib/helpers/callbackify.js +0 -18
  516. package/node_modules/axios/lib/helpers/combineURLs.js +0 -15
  517. package/node_modules/axios/lib/helpers/composeSignals.js +0 -56
  518. package/node_modules/axios/lib/helpers/cookies.js +0 -60
  519. package/node_modules/axios/lib/helpers/deprecatedMethod.js +0 -31
  520. package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +0 -100
  521. package/node_modules/axios/lib/helpers/formDataToJSON.js +0 -97
  522. package/node_modules/axios/lib/helpers/formDataToStream.js +0 -119
  523. package/node_modules/axios/lib/helpers/fromDataURI.js +0 -53
  524. package/node_modules/axios/lib/helpers/isAbsoluteURL.js +0 -19
  525. package/node_modules/axios/lib/helpers/isAxiosError.js +0 -14
  526. package/node_modules/axios/lib/helpers/isURLSameOrigin.js +0 -16
  527. package/node_modules/axios/lib/helpers/null.js +0 -2
  528. package/node_modules/axios/lib/helpers/parseHeaders.js +0 -69
  529. package/node_modules/axios/lib/helpers/parseProtocol.js +0 -6
  530. package/node_modules/axios/lib/helpers/progressEventReducer.js +0 -51
  531. package/node_modules/axios/lib/helpers/readBlob.js +0 -15
  532. package/node_modules/axios/lib/helpers/resolveConfig.js +0 -106
  533. package/node_modules/axios/lib/helpers/shouldBypassProxy.js +0 -178
  534. package/node_modules/axios/lib/helpers/speedometer.js +0 -55
  535. package/node_modules/axios/lib/helpers/spread.js +0 -28
  536. package/node_modules/axios/lib/helpers/throttle.js +0 -44
  537. package/node_modules/axios/lib/helpers/toFormData.js +0 -249
  538. package/node_modules/axios/lib/helpers/toURLEncodedForm.js +0 -19
  539. package/node_modules/axios/lib/helpers/trackStream.js +0 -89
  540. package/node_modules/axios/lib/helpers/validator.js +0 -112
  541. package/node_modules/axios/lib/platform/browser/classes/Blob.js +0 -3
  542. package/node_modules/axios/lib/platform/browser/classes/FormData.js +0 -3
  543. package/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +0 -4
  544. package/node_modules/axios/lib/platform/browser/index.js +0 -13
  545. package/node_modules/axios/lib/platform/common/utils.js +0 -52
  546. package/node_modules/axios/lib/platform/index.js +0 -7
  547. package/node_modules/axios/lib/platform/node/classes/FormData.js +0 -3
  548. package/node_modules/axios/lib/platform/node/classes/URLSearchParams.js +0 -4
  549. package/node_modules/axios/lib/platform/node/index.js +0 -37
  550. package/node_modules/axios/lib/utils.js +0 -931
  551. package/node_modules/axios/package.json +0 -183
  552. package/node_modules/combined-stream/License +0 -19
  553. package/node_modules/combined-stream/Readme.md +0 -138
  554. package/node_modules/combined-stream/lib/combined_stream.js +0 -208
  555. package/node_modules/combined-stream/package.json +0 -25
  556. package/node_modules/delayed-stream/.npmignore +0 -1
  557. package/node_modules/delayed-stream/License +0 -19
  558. package/node_modules/delayed-stream/Makefile +0 -7
  559. package/node_modules/delayed-stream/Readme.md +0 -141
  560. package/node_modules/delayed-stream/lib/delayed_stream.js +0 -107
  561. package/node_modules/delayed-stream/package.json +0 -27
  562. package/node_modules/es-set-tostringtag/.eslintrc +0 -13
  563. package/node_modules/es-set-tostringtag/.nycrc +0 -9
  564. package/node_modules/es-set-tostringtag/CHANGELOG.md +0 -67
  565. package/node_modules/es-set-tostringtag/README.md +0 -53
  566. package/node_modules/es-set-tostringtag/index.d.ts +0 -10
  567. package/node_modules/es-set-tostringtag/index.js +0 -35
  568. package/node_modules/es-set-tostringtag/package.json +0 -78
  569. package/node_modules/es-set-tostringtag/test/index.js +0 -85
  570. package/node_modules/es-set-tostringtag/tsconfig.json +0 -9
  571. package/node_modules/follow-redirects/LICENSE +0 -18
  572. package/node_modules/follow-redirects/README.md +0 -157
  573. package/node_modules/follow-redirects/debug.js +0 -15
  574. package/node_modules/follow-redirects/http.js +0 -1
  575. package/node_modules/follow-redirects/https.js +0 -1
  576. package/node_modules/follow-redirects/index.js +0 -709
  577. package/node_modules/follow-redirects/package.json +0 -58
  578. package/node_modules/form-data/CHANGELOG.md +0 -669
  579. package/node_modules/form-data/License +0 -19
  580. package/node_modules/form-data/README.md +0 -350
  581. package/node_modules/form-data/index.d.ts +0 -51
  582. package/node_modules/form-data/lib/browser.js +0 -4
  583. package/node_modules/form-data/lib/form_data.js +0 -514
  584. package/node_modules/form-data/lib/populate.js +0 -10
  585. package/node_modules/form-data/node_modules/mime-db/HISTORY.md +0 -507
  586. package/node_modules/form-data/node_modules/mime-db/LICENSE +0 -23
  587. package/node_modules/form-data/node_modules/mime-db/README.md +0 -100
  588. package/node_modules/form-data/node_modules/mime-db/db.json +0 -8519
  589. package/node_modules/form-data/node_modules/mime-db/index.js +0 -12
  590. package/node_modules/form-data/node_modules/mime-db/package.json +0 -60
  591. package/node_modules/form-data/node_modules/mime-types/HISTORY.md +0 -397
  592. package/node_modules/form-data/node_modules/mime-types/LICENSE +0 -23
  593. package/node_modules/form-data/node_modules/mime-types/README.md +0 -113
  594. package/node_modules/form-data/node_modules/mime-types/index.js +0 -188
  595. package/node_modules/form-data/node_modules/mime-types/package.json +0 -44
  596. package/node_modules/form-data/package.json +0 -83
  597. package/node_modules/has-tostringtag/.eslintrc +0 -5
  598. package/node_modules/has-tostringtag/.github/FUNDING.yml +0 -12
  599. package/node_modules/has-tostringtag/.nycrc +0 -13
  600. package/node_modules/has-tostringtag/CHANGELOG.md +0 -42
  601. package/node_modules/has-tostringtag/README.md +0 -46
  602. package/node_modules/has-tostringtag/index.d.ts +0 -3
  603. package/node_modules/has-tostringtag/index.js +0 -8
  604. package/node_modules/has-tostringtag/package.json +0 -108
  605. package/node_modules/has-tostringtag/shams.d.ts +0 -3
  606. package/node_modules/has-tostringtag/shams.js +0 -8
  607. package/node_modules/has-tostringtag/test/index.js +0 -21
  608. package/node_modules/has-tostringtag/test/shams/core-js.js +0 -31
  609. package/node_modules/has-tostringtag/test/shams/get-own-property-symbols.js +0 -30
  610. package/node_modules/has-tostringtag/test/tests.js +0 -15
  611. package/node_modules/has-tostringtag/tsconfig.json +0 -49
  612. package/node_modules/is-electron/LICENSE +0 -21
  613. package/node_modules/is-electron/README.md +0 -25
  614. package/node_modules/is-electron/index.d.ts +0 -2
  615. package/node_modules/is-electron/index.js +0 -21
  616. package/node_modules/is-electron/package.json +0 -34
  617. package/node_modules/is-stream/index.d.ts +0 -79
  618. package/node_modules/is-stream/index.js +0 -28
  619. package/node_modules/is-stream/license +0 -9
  620. package/node_modules/is-stream/package.json +0 -42
  621. package/node_modules/is-stream/readme.md +0 -60
  622. package/node_modules/proxy-from-env/LICENSE +0 -20
  623. package/node_modules/proxy-from-env/README.md +0 -163
  624. package/node_modules/proxy-from-env/index.cjs +0 -105
  625. package/node_modules/proxy-from-env/index.js +0 -103
  626. package/node_modules/proxy-from-env/package.json +0 -43
  627. package/npm-shrinkwrap.json +0 -1440
@@ -1,2391 +0,0 @@
1
- <h3 align="center">💎 Platinum sponsors <br /></h3>
2
- <table align="center">
3
- <tr>
4
- <td align="center" width="50%">
5
- <a
6
- href="https://thanks.dev/?utm_source&#x3D;axios&amp;utm_medium&#x3D;sponsorlist&amp;utm_campaign&#x3D;sponsorship"
7
- style="padding: 10px; display: inline-block"
8
- target="_blank"
9
- >
10
- <img
11
- width="90px"
12
- height="90px"
13
- src="https://images.opencollective.com/thanks-dev/360b917/logo/256.png?height=256"
14
- alt="Thanks.dev"
15
- />
16
- </a>
17
- <p
18
- align="center"
19
- >
20
- We're passionate about making open source sustainable. Scan your dependency tree to better understand which open source projects need funding.
21
- </p>
22
- <p align="center">
23
- <a
24
- href="https://thanks.dev/?utm_source&#x3D;axios&amp;utm_medium&#x3D;readme_sponsorlist&amp;utm_campaign&#x3D;sponsorship"
25
- target="_blank"
26
- ><b>thanks.dev</b></a
27
- >
28
- </p>
29
- </td>
30
- <td align="center" width="50%">
31
- <a
32
- href="https://hopper.security/?utm_source&#x3D;axios&amp;utm_medium&#x3D;readme_sponsorlist&amp;utm_campaign&#x3D;sponsorship"
33
- style="padding: 10px; display: inline-block"
34
- target="_blank"
35
- >
36
- <img
37
- width="90px"
38
- height="90px"
39
- src="https://images.opencollective.com/hopper-security/c4f7de2/avatar.png"
40
- alt="Hopper Security"
41
- />
42
- </a>
43
- <p align="center">
44
- Hopper provides a secure, open-source registry where every component is verified against malware and continuously remediated for vulnerabilities across all versions. In simple terms, Hopper removes the need to manage software supply chain risk altogether.
45
- </p>
46
- <p align="center">
47
- <a
48
- href="https://hopper.security/?utm_source&#x3D;axios&amp;utm_medium&#x3D;readme_sponsorlist&amp;utm_campaign&#x3D;sponsorship"
49
- target="_blank"
50
- ><b>hopper.security</b></a
51
- >
52
- </p>
53
- </td>
54
- </tr>
55
- </table>
56
- <table align="center">
57
- <tr>
58
- <td align="center" width="50%">
59
- <a
60
- href="https://opencollective.com/axios/contribute"
61
- target="_blank"
62
- >💜 Become a sponsor</a
63
- >
64
- </td>
65
- <td align="center" width="50%">
66
- <a
67
- href="https://opencollective.com/axios/contribute"
68
- target="_blank"
69
- >💜 Become a sponsor</a
70
- >
71
- </td>
72
- </tr>
73
- </table>
74
- <h3 align="center">🥇 Gold sponsors <br /></h3>
75
- <table align="center" width="100%">
76
- <tr width="33.333333333333336%">
77
- <td align="center" width="33.333333333333336%">
78
- <a
79
- href="https://www.principal.com/about-us?utm_source&#x3D;axios&amp;utm_medium&#x3D;sponsorlist&amp;utm_campaign&#x3D;sponsorship"
80
- style="padding: 10px; display: inline-block"
81
- target="_blank"
82
- >
83
- <img
84
- width="90px"
85
- height="90px"
86
- src="https://images.opencollective.com/principal/431e690/logo.png"
87
- alt="Principal Financial Group"
88
- />
89
- </a>
90
- <p
91
- align="center"
92
- >
93
- Free tools to help with your financial planning needs!
94
- </p>
95
- <p align="center">
96
- <a
97
- href="https://www.principal.com/about-us?utm_source&#x3D;axios&amp;utm_medium&#x3D;readme_sponsorlist&amp;utm_campaign&#x3D;sponsorship"
98
- target="_blank"
99
- ><b>principal.com</b></a
100
- >
101
- </p>
102
- </td>
103
- <td align="center" width="33.333333333333336%">
104
- <a
105
- href="https://opensource.sap.com?utm_source&#x3D;axios&amp;utm_medium&#x3D;sponsorlist&amp;utm_campaign&#x3D;sponsorship"
106
- style="padding: 10px; display: inline-block"
107
- target="_blank"
108
- >
109
- <img
110
- width="90px"
111
- height="90px"
112
- src="https://avatars.githubusercontent.com/u/2531208?s=200&v=4"
113
- alt="SAP"
114
- />
115
- </a>
116
- <p
117
- align="center"
118
- title="SAP SE, a global software company, is one of the largest vendors of ERP and other enterprise applications."
119
- >
120
- BSAP SE, a global software company, is one of the largest vendors of ERP and other enterprise applications.
121
- </p>
122
- <p align="center">
123
- <a
124
- href="https://opensource.sap.com?utm_source&#x3D;axios&amp;utm_medium&#x3D;readme_sponsorlist&amp;utm_campaign&#x3D;sponsorship"
125
- target="_blank"
126
- ><b>opensource.sap.com</b></a
127
- >
128
- </p>
129
- </td>
130
- <td align="center" width="33.333333333333336%">
131
- <a
132
- href="https://www.descope.com/?utm_source&#x3D;axios&amp;utm_medium&#x3D;referral&amp;utm_campaign&#x3D;axios-oss-sponsorship"
133
- style="padding: 10px; display: inline-block"
134
- target="_blank"
135
- >
136
- <img
137
- width="90px"
138
- height="90px"
139
- src="https://images.opencollective.com/descope/b53243e/logo.png"
140
- alt="Descope"
141
- />
142
- </a>
143
- <p
144
- align="center"
145
- 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."
146
- >
147
- Reduce user friction, prevent account takeover, and get a 360° view of your customer and agentic identities with the Descope External IAM platform.
148
- </p>
149
- <p align="center">
150
- <a
151
- href="https://www.descope.com/?utm_source&#x3D;axios&amp;utm_medium&#x3D;referral&amp;utm_campaign&#x3D;axios-oss-sponsorship"
152
- target="_blank"
153
- ><b>descope.com</b></a
154
- >
155
- </p>
156
- </td>
157
- </tr>
158
- <tr width="33.333333333333336%">
159
- <td align="center" width="33.333333333333336%">
160
- <a
161
- href="https://stytch.com/"
162
- style="padding: 10px; display: inline-block"
163
- target="_blank"
164
- >
165
- <img
166
- width="90px"
167
- height="90px"
168
- src="https://images.opencollective.com/stytch/f84ce43/logo/256.png?height=256"
169
- alt="Stytch"
170
- />
171
- </a>
172
- <p
173
- align="center"
174
- >
175
- The identity platform for humans & AI agents
176
- </p>
177
- <p align="center">
178
- <a
179
- href="https://stytch.com"
180
- target="_blank"
181
- ><b>stytch.com</b></a
182
- >
183
- </p>
184
- </td>
185
- <td align="center" width="33.333333333333336%">
186
- <a
187
- href="https://rxdb.info/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship&utm_content=logo"
188
- style="padding: 10px; display: inline-block"
189
- target="_blank"
190
- >
191
- <img
192
- width="90px"
193
- height="90px"
194
- src="https://rxdb.info/files/logo/logo_text_white.svg"
195
- alt="RxDB"
196
- />
197
- </a>
198
- <p
199
- align="center"
200
- >
201
- RxDB is a NoSQL database for JavaScript that runs directly in your app.
202
- </p>
203
- <p align="center">
204
- <a
205
- href="https://rxdb.info/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship&utm_content=logo"
206
- target="_blank"
207
- ><b>rxdb.info</b></a
208
- >
209
- </p>
210
- </td>
211
- <td align="center" width="33.333333333333336%">
212
- <a
213
- href="https://poprey.com/?utm_source&#x3D;axios&amp;utm_medium&#x3D;sponsorlist&amp;utm_campaign&#x3D;sponsorship"
214
- style="padding: 10px; display: inline-block"
215
- target="_blank"
216
- >
217
- <img
218
- width="70px"
219
- height="70px"
220
- src="https://images.opencollective.com/instagram-likes/2a72a03/avatar.png"
221
- alt="Poprey"
222
- />
223
- </a>
224
- <p align="center">
225
- Buy Instagram Likes
226
- </p>
227
- <p align="center">
228
- <a
229
- href="https://poprey.com/?utm_source&#x3D;axios&amp;utm_medium&#x3D;readme_sponsorlist&amp;utm_campaign&#x3D;sponsorship"
230
- target="_blank"
231
- ><b>poprey.com</b></a
232
- >
233
- </p>
234
- </td>
235
- </tr>
236
- <tr width="33.333333333333336%">
237
- <td align="center" width="33.333333333333336%">
238
- <a
239
- href="https://buzzoid.com/buy-instagram-followers/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
240
- style="padding: 10px; display: inline-block"
241
- target="_blank"
242
- >
243
- <img
244
- width="71px"
245
- height="70px"
246
- src="https://images.opencollective.com/buzzoid-buy-instagram-followers/56a09fe/logo.png"
247
- alt="Buzzoid"
248
- />
249
- </a>
250
- <p
251
- align="center"
252
- >
253
- A lightweight open-source API Development, Testing &amp; Mocking
254
- platform
255
- </p>
256
- <p align="center">
257
- <a
258
- href="https://buzzoid.com/buy-instagram-followers/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
259
- target="_blank"
260
- ><b>buzzoid.com</b></a
261
- >
262
- </p>
263
- </td>
264
- <td align="center" width="33.333333333333336%">
265
- <a
266
- href="https://opencollective.com/axios/contribute"
267
- target="_blank"
268
- >💜 Become a sponsor</a
269
- >
270
- </td>
271
- <td align="center" width="33.333333333333336%">
272
- <a
273
- href="https://opencollective.com/axios/contribute"
274
- target="_blank"
275
- >💜 Become a sponsor</a
276
- >
277
- </td>
278
- </tr>
279
- </table>
280
-
281
-
282
- <!--<div>marker</div>-->
283
-
284
- <br><br>
285
-
286
- <div align="center">
287
- <a href="https://axios.rest"><img src="https://axios.rest/logo.svg" alt="Axios" /></a><br>
288
- </div>
289
-
290
- <p align="center">Promise based HTTP client for the browser and node.js</p>
291
-
292
- <p align="center">
293
- <a href="https://axios.rest/"><b>Website</b></a> •
294
- <a href="https://axios.rest/pages/getting-started/first-steps.html"><b>Documentation</b></a>
295
- </p>
296
-
297
- <div align="center">
298
-
299
- [![npm version](https://img.shields.io/npm/v/axios.svg?style=flat-square)](https://www.npmjs.org/package/axios)
300
- [![CDNJS](https://img.shields.io/cdnjs/v/axios.svg?style=flat-square)](https://cdnjs.com/libraries/axios)
301
- [![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)
302
- [![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)
303
- [![code coverage](https://img.shields.io/coveralls/mzabriskie/axios.svg?style=flat-square)](https://coveralls.io/r/mzabriskie/axios)
304
- [![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)
305
- [![npm bundle size](https://img.shields.io/bundlephobia/minzip/axios?style=flat-square)](https://bundlephobia.com/package/axios@latest)
306
- [![npm downloads](https://img.shields.io/npm/dm/axios.svg?style=flat-square)](https://npm-stat.com/charts.html?package=axios)
307
- [![gitter chat](https://img.shields.io/gitter/room/mzabriskie/axios.svg?style=flat-square)](https://gitter.im/mzabriskie/axios)
308
- [![code helpers](https://www.codetriage.com/axios/axios/badges/users.svg)](https://www.codetriage.com/axios/axios)
309
- [![Contributors](https://img.shields.io/github/contributors/axios/axios.svg?style=flat-square)](CONTRIBUTORS.md)
310
-
311
- </div>
312
-
313
- ## Table of Contents
314
-
315
- - [Features](#features)
316
- - [Browser Support](#browser-support)
317
- - [Installing](#installing)
318
- - [Package manager](#package-manager)
319
- - [CDN](#cdn)
320
- - [Example](#example)
321
- - [Axios API](#axios-api)
322
- - [Request method aliases](#request-method-aliases)
323
- - [Concurrency 👎](#concurrency-deprecated)
324
- - [Creating an instance](#creating-an-instance)
325
- - [Instance methods](#instance-methods)
326
- - [Request Config](#request-config)
327
- - [Response Schema](#response-schema)
328
- - [Config Defaults](#config-defaults)
329
- - [Global axios defaults](#global-axios-defaults)
330
- - [Custom instance defaults](#custom-instance-defaults)
331
- - [Config order of precedence](#config-order-of-precedence)
332
- - [Interceptors](#interceptors)
333
- - [Multiple Interceptors](#multiple-interceptors)
334
- - [Handling Errors](#handling-errors)
335
- - [Handling Timeouts](#handling-timeouts)
336
- - [Cancellation](#cancellation)
337
- - [AbortController](#abortcontroller)
338
- - [CancelToken 👎](#canceltoken-deprecated)
339
- - [Using application/x-www-form-urlencoded format](#using-applicationx-www-form-urlencoded-format)
340
- - [URLSearchParams](#urlsearchparams)
341
- - [Query string](#query-string-older-browsers)
342
- - [🆕 Automatic serialization](#-automatic-serialization-to-urlsearchparams)
343
- - [Using multipart/form-data format](#using-multipartform-data-format)
344
- - [FormData](#formdata)
345
- - [🆕 Automatic serialization](#-automatic-serialization-to-formdata)
346
- - [Files Posting](#files-posting)
347
- - [HTML Form Posting](#-html-form-posting-browser)
348
- - [🆕 Progress capturing](#-progress-capturing)
349
- - [🆕 Rate limiting](#-rate-limiting)
350
- - [🆕 AxiosHeaders](#-axiosheaders)
351
- - [🔥 Fetch adapter](#-fetch-adapter)
352
- - [🔥 Custom fetch](#-custom-fetch)
353
- - [🔥 Using with Tauri](#-using-with-tauri)
354
- - [🔥 Using with SvelteKit](#-using-with-sveltekit)
355
- - [🔥 HTTP2](#-http2)
356
- - [Semver](#semver)
357
- - [Promises](#promises)
358
- - [TypeScript](#typescript)
359
- - [Contributing](#contributing)
360
- - [Local setup](#local-setup)
361
- - [Resources](#resources)
362
- - [Credits](#credits)
363
- - [License](#license)
364
-
365
- ## Features
366
-
367
- - **Browser Requests:** Make [XMLHttpRequests](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) directly from the browser.
368
- - **Node.js Requests:** Make [http](https://nodejs.org/api/http.html) requests from Node.js environments.
369
- - **Promise-based:** Fully supports the [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) API for easier asynchronous code.
370
- - **Interceptors:** Intercept requests and responses to add custom logic or transform data.
371
- - **Data Transformation:** Transform request and response data automatically.
372
- - **Request Cancellation:** Cancel requests using built-in mechanisms.
373
- - **Automatic JSON Handling:** Automatically serializes and parses [JSON](https://www.json.org/json-en.html) data.
374
- - **Form Serialization:** 🆕 Automatically serializes data objects to `multipart/form-data` or `x-www-form-urlencoded` formats.
375
- - **XSRF Protection:** Client-side support to protect against [Cross-Site Request Forgery](https://en.wikipedia.org/wiki/Cross-site_request_forgery).
376
-
377
- ## Browser Support
378
-
379
- | Chrome | Firefox | Safari | Opera | Edge |
380
- | :------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------: |
381
- | ![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) |
382
- | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ |
383
-
384
- [![Browser Matrix](https://saucelabs.com/open_sauce/build_matrix/axios.svg)](https://saucelabs.com/u/axios)
385
-
386
- ## Installing
387
-
388
- ### Package manager
389
-
390
- Using npm:
391
-
392
- ```bash
393
- $ npm install axios
394
- ```
395
-
396
- Using yarn:
397
-
398
- ```bash
399
- $ yarn add axios
400
- ```
401
-
402
- Using pnpm:
403
-
404
- ```bash
405
- $ pnpm add axios
406
- ```
407
-
408
- Using bun:
409
-
410
- ```bash
411
- $ bun add axios
412
- ```
413
-
414
- Once the package is installed, you can import the library using `import` or `require` approach:
415
-
416
- ```js
417
- import axios, { isCancel, AxiosError } from 'axios';
418
- ```
419
-
420
- You can also use the default export, since the named export is just a re-export from the Axios factory:
421
-
422
- ```js
423
- import axios from 'axios';
424
-
425
- console.log(axios.isCancel('something'));
426
- ```
427
-
428
- If you use `require` for importing, **only the default export is available**:
429
-
430
- ```js
431
- const axios = require('axios');
432
-
433
- console.log(axios.isCancel('something'));
434
- ```
435
-
436
- For some bundlers and some ES6 linters you may need to do the following:
437
-
438
- ```js
439
- import { default as axios } from 'axios';
440
- ```
441
-
442
- For cases where something went wrong when trying to import a module into a custom or legacy environment,
443
- you can try importing the module package directly:
444
-
445
- ```js
446
- const axios = require('axios/dist/browser/axios.cjs'); // browser commonJS bundle (ES2017)
447
- // const axios = require('axios/dist/node/axios.cjs'); // node commonJS bundle (ES2017)
448
- ```
449
-
450
- ### CDN
451
-
452
- Using jsDelivr CDN (ES5 UMD browser module):
453
-
454
- ```html
455
- <script src="https://cdn.jsdelivr.net/npm/axios@1.13.2/dist/axios.min.js"></script>
456
- ```
457
-
458
- Using unpkg CDN:
459
-
460
- ```html
461
- <script src="https://unpkg.com/axios@1.13.2/dist/axios.min.js"></script>
462
- ```
463
-
464
- ## Example
465
-
466
- ```js
467
- import axios from 'axios';
468
- //const axios = require('axios'); // legacy way
469
-
470
- try {
471
- const response = await axios.get('/user?ID=12345');
472
- console.log(response);
473
- } catch (error) {
474
- console.error(error);
475
- }
476
-
477
- // Optionally the request above could also be done as
478
- axios
479
- .get('/user', {
480
- params: {
481
- ID: 12345,
482
- },
483
- timeout: 5000, // 5 seconds — see "Handling Timeouts" below for matching error handling
484
- })
485
- .then(function (response) {
486
- console.log(response);
487
- })
488
- .catch(function (error) {
489
- console.log(error);
490
- })
491
- .finally(function () {
492
- // always executed
493
- });
494
-
495
- // Want to use async/await? Add the `async` keyword to your outer function/method.
496
- async function getUser() {
497
- try {
498
- const response = await axios.get('/user?ID=12345');
499
- console.log(response);
500
- } catch (error) {
501
- console.error(error);
502
- }
503
- }
504
- ```
505
-
506
- > **Note**: Set a `timeout` in production — without one, a stalled request can hang
507
- > indefinitely. See [Handling Timeouts](#handling-timeouts) for the matching error handling.
508
-
509
- > **Note**: `async/await` is part of ECMAScript 2017 and is not supported in Internet
510
- > Explorer and older browsers, so use with caution.
511
-
512
- Performing a `POST` request
513
-
514
- ```js
515
- const response = await axios.post('/user', {
516
- firstName: 'Fred',
517
- lastName: 'Flintstone',
518
- });
519
- console.log(response);
520
- ```
521
-
522
- Performing multiple concurrent requests
523
-
524
- ```js
525
- function getUserAccount() {
526
- return axios.get('/user/12345');
527
- }
528
-
529
- function getUserPermissions() {
530
- return axios.get('/user/12345/permissions');
531
- }
532
-
533
- Promise.all([getUserAccount(), getUserPermissions()]).then(function (results) {
534
- const acct = results[0];
535
- const perm = results[1];
536
- });
537
- ```
538
-
539
- ## axios API
540
-
541
- Requests can be made by passing the relevant config to `axios`.
542
-
543
- ##### axios(config)
544
-
545
- ```js
546
- // Send a POST request
547
- axios({
548
- method: 'post',
549
- url: '/user/12345',
550
- data: {
551
- firstName: 'Fred',
552
- lastName: 'Flintstone',
553
- },
554
- });
555
- ```
556
-
557
- ```js
558
- // GET request for remote image in node.js
559
- const response = await axios({
560
- method: 'get',
561
- url: 'https://bit.ly/2mTM3nY',
562
- responseType: 'stream',
563
- });
564
- response.data.pipe(fs.createWriteStream('ada_lovelace.jpg'));
565
- ```
566
-
567
- ##### axios(url[, config])
568
-
569
- ```js
570
- // Send a GET request (default method)
571
- axios('/user/12345');
572
- ```
573
-
574
- ### Request method aliases
575
-
576
- For convenience, aliases have been provided for all common request methods.
577
-
578
- ##### axios.request(config)
579
-
580
- ##### axios.get(url[, config])
581
-
582
- ##### axios.delete(url[, config])
583
-
584
- ##### axios.head(url[, config])
585
-
586
- ##### axios.options(url[, config])
587
-
588
- ##### axios.post(url[, data[, config]])
589
-
590
- ##### axios.put(url[, data[, config]])
591
-
592
- ##### axios.patch(url[, data[, config]])
593
-
594
- ###### NOTE
595
-
596
- When using the alias methods `url`, `method`, and `data` properties don't need to be specified in config.
597
-
598
- ### Concurrency (Deprecated)
599
-
600
- Please use `Promise.all` to replace the below functions.
601
-
602
- Helper functions for dealing with concurrent requests.
603
-
604
- axios.all(iterable)
605
- axios.spread(callback)
606
-
607
- ### Creating an instance
608
-
609
- You can create a new instance of axios with a custom config.
610
-
611
- ##### axios.create([config])
612
-
613
- ```js
614
- const instance = axios.create({
615
- baseURL: 'https://some-domain.com/api/',
616
- timeout: 1000,
617
- headers: { 'X-Custom-Header': 'foobar' },
618
- });
619
- ```
620
-
621
- ### Instance methods
622
-
623
- The available instance methods are listed below. The specified config will be merged with the instance config.
624
-
625
- ##### axios#request(config)
626
-
627
- ##### axios#get(url[, config])
628
-
629
- ##### axios#delete(url[, config])
630
-
631
- ##### axios#head(url[, config])
632
-
633
- ##### axios#options(url[, config])
634
-
635
- ##### axios#post(url[, data[, config]])
636
-
637
- ##### axios#put(url[, data[, config]])
638
-
639
- ##### axios#patch(url[, data[, config]])
640
-
641
- ##### axios#getUri([config])
642
-
643
- ## Request Config
644
-
645
- ### ⚠️ Security notice: decompression-bomb protection is opt-in
646
-
647
- By default `maxContentLength` and `maxBodyLength` are `-1` (unlimited). A malicious or compromised server can return a tiny gzip/deflate/brotli body that expands to gigabytes and exhaust the Node.js process.
648
-
649
- If you call servers you do not fully trust, **set a cap**:
650
-
651
- ```js
652
- axios.defaults.maxContentLength = 10 * 1024 * 1024; // 10 MB
653
- axios.defaults.maxBodyLength = 10 * 1024 * 1024;
654
- ```
655
-
656
- See the [security guide](https://axios.rest/pages/misc/security.html) for details.
657
-
658
- These are the available config options for making requests. Only the `url` is required. Requests will default to `GET` if `method` is not specified.
659
-
660
- ```js
661
- {
662
- // `url` is the server URL that will be used for the request
663
- url: '/user',
664
-
665
- // `method` is the request method to be used when making the request
666
- method: 'get', // default
667
-
668
- // `baseURL` will be prepended to `url` unless `url` is absolute and the option `allowAbsoluteUrls` is set to true.
669
- // It can be convenient to set `baseURL` for an instance of axios to pass relative URLs
670
- // to the methods of that instance.
671
- baseURL: 'https://some-domain.com/api/',
672
-
673
- // `allowAbsoluteUrls` determines whether or not absolute URLs will override a configured `baseUrl`.
674
- // When set to true (default), absolute values for `url` will override `baseUrl`.
675
- // When set to false, absolute values for `url` will always be prepended by `baseUrl`.
676
- allowAbsoluteUrls: true,
677
-
678
- // `transformRequest` allows changes to the request data before it is sent to the server
679
- // This is only applicable for request methods 'PUT', 'POST', 'PATCH' and 'DELETE'
680
- // The last function in the array must return a string or an instance of Buffer, ArrayBuffer,
681
- // FormData or Stream
682
- // You may modify the headers object.
683
- transformRequest: [function (data, headers) {
684
- // Do whatever you want to transform the data
685
-
686
- return data;
687
- }],
688
-
689
- // `transformResponse` allows changes to the response data to be made before
690
- // it is passed to then/catch
691
- transformResponse: [function (data) {
692
- // Do whatever you want to transform the data
693
-
694
- return data;
695
- }],
696
-
697
- // `parseReviver` is an optional function that will be passed as the
698
- // second argument (reviver) to JSON.parse()
699
- parseReviver: function (key, value, context) {
700
- // In modern environments, context.source provides the raw JSON string
701
- // allowing for precision-safe parsing of BigInt
702
- if (typeof value === 'number' && context?.source) {
703
- const isInteger = Number.isInteger(value);
704
- const isUnsafe = !Number.isSafeInteger(value);
705
- const isValidIntegerString = /^-?\d+$/.test(context.source);
706
-
707
- if (isInteger && isUnsafe && isValidIntegerString) {
708
- try {
709
- return BigInt(context.source);
710
- } catch {
711
- // Fallback: return original value if parsing fails
712
- }
713
- }
714
- }
715
- return value;
716
- },
717
-
718
- // `headers` are custom headers to be sent
719
- headers: {'X-Requested-With': 'XMLHttpRequest'},
720
-
721
- // `params` are the URL parameters to be sent with the request
722
- // Must be a plain object or a URLSearchParams object
723
- params: {
724
- ID: 12345
725
- },
726
-
727
- // `paramsSerializer` is an optional config that allows you to customize serializing `params`.
728
- paramsSerializer: {
729
-
730
- // Custom encoder function which sends key/value pairs in an iterative fashion.
731
- encode?: (param: string): string => { /* Do custom operations here and return transformed string */ },
732
-
733
- // Custom serializer function for the entire parameter. Allows the user to mimic pre 1.x behaviour.
734
- serialize?: (params: Record<string, any>, options?: ParamsSerializerOptions ),
735
-
736
- // Configuration for formatting array indexes in the params.
737
- 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).
738
-
739
- // Maximum object nesting depth when serializing params. Payloads deeper than this throw an
740
- // AxiosError with code ERR_FORM_DATA_DEPTH_EXCEEDED. Default: 100. Set to Infinity to disable.
741
- maxDepth: 100
742
-
743
- },
744
-
745
- // `data` is the data to be sent as the request body
746
- // Only applicable for request methods 'PUT', 'POST', 'DELETE', and 'PATCH'
747
- // When no `transformRequest` is set, it must be of one of the following types:
748
- // - string, plain object, ArrayBuffer, ArrayBufferView, URLSearchParams
749
- // - Browser only: FormData, File, Blob
750
- // - Node only: Stream, Buffer, FormData (form-data package)
751
- data: {
752
- firstName: 'Fred'
753
- },
754
-
755
- // `formDataHeaderPolicy` controls how node.js FormData#getHeaders() is copied.
756
- // 'legacy' (default) copies all returned headers for v1 compatibility.
757
- // 'content-only' copies only Content-Type and Content-Length.
758
- formDataHeaderPolicy: 'legacy',
759
-
760
- // syntax alternative to send data into the body
761
- // method post
762
- // only the value is sent, not the key
763
- data: 'Country=Brasil&City=Belo Horizonte',
764
-
765
- // `timeout` specifies the number of milliseconds before the request times out.
766
- // If the request takes longer than `timeout`, the request will be aborted.
767
- timeout: 1000, // default is `0` (no timeout)
768
-
769
- // `withCredentials` indicates whether or not cross-site Access-Control requests
770
- // should be made using credentials
771
- // This only controls whether the browser sends credentials.
772
- // It does not control whether the XSRF header is added.
773
- withCredentials: false, // default
774
-
775
- // `adapter` allows custom handling of requests which makes testing easier.
776
- // Return a promise and supply a valid response (see lib/adapters/README.md)
777
- adapter: function (config) {
778
- /* ... */
779
- },
780
- // Also, you can set the name of the built-in adapter, or provide an array with their names
781
- // to choose the first available in the environment
782
- adapter: 'xhr', // 'fetch' | 'http' | ['xhr', 'http', 'fetch']
783
-
784
- // `auth` indicates that HTTP Basic auth should be used, and supplies credentials.
785
- // This will set an `Authorization` header, overwriting any existing
786
- // `Authorization` custom headers you have set using `headers`.
787
- // Please note that only HTTP Basic auth is configurable through this parameter.
788
- // For Bearer tokens and such, use `Authorization` custom headers instead.
789
- auth: {
790
- username: 'janedoe',
791
- password: 's00pers3cret'
792
- },
793
-
794
- // `responseType` indicates the type of data that the server will respond with
795
- // options are: 'arraybuffer', 'document', 'json', 'text', 'stream'
796
- // browser only: 'blob'
797
- responseType: 'json', // default
798
-
799
- // `responseEncoding` indicates encoding to use for decoding responses (Node.js only)
800
- // Note: Ignored for `responseType` of 'stream' or client-side requests
801
- // options are: 'ascii', 'ASCII', 'ansi', 'ANSI', 'binary', 'BINARY', 'base64', 'BASE64', 'base64url',
802
- // 'BASE64URL', 'hex', 'HEX', 'latin1', 'LATIN1', 'ucs-2', 'UCS-2', 'ucs2', 'UCS2', 'utf-8', 'UTF-8',
803
- // 'utf8', 'UTF8', 'utf16le', 'UTF16LE'
804
- responseEncoding: 'utf8', // default
805
-
806
- // `xsrfCookieName` is the name of the cookie to use as a value for the xsrf token
807
- xsrfCookieName: 'XSRF-TOKEN', // default
808
-
809
- // `xsrfHeaderName` is the name of the http header that carries the xsrf token value
810
- xsrfHeaderName: 'X-XSRF-TOKEN', // default
811
-
812
- // `withXSRFToken` defines whether to send the XSRF header in browser requests.
813
- // `undefined` (default) - set XSRF header only for the same origin requests
814
- // `true` - always set XSRF header, including for cross-origin requests
815
- // `false` - never set XSRF header
816
- // function - resolve with custom logic; receives the internal config object
817
- withXSRFToken: boolean | undefined | ((config: InternalAxiosRequestConfig) => boolean | undefined),
818
-
819
- // `withXSRFToken` controls whether Axios reads the XSRF cookie and sets the XSRF header.
820
- // - `undefined` (default): the XSRF header is set only for same-origin requests.
821
- // - `true`: attempt to set the XSRF header for all requests (including cross-origin).
822
- // - `false`: never set the XSRF header.
823
- // - function: a callback that receives the request `config` and returns `true`,
824
- // `false`, or `undefined` to decide per-request behavior.
825
- //
826
- // Note about `withCredentials`: `withCredentials` controls whether cross-site
827
- // requests include credentials (cookies and HTTP auth). In older Axios versions,
828
- // setting `withCredentials: true` implicitly caused Axios to set the XSRF header
829
- // for cross-origin requests. Newer Axios separates these concerns: to allow the
830
- // XSRF header to be sent for cross-origin requests you should set both
831
- // `withCredentials: true` and `withXSRFToken: true`.
832
- //
833
- // Example:
834
- // axios.get('/user', { withCredentials: true, withXSRFToken: true });
835
-
836
- // `onUploadProgress` allows handling of progress events for uploads
837
- // browser & node.js
838
- onUploadProgress: function ({loaded, total, progress, bytes, estimated, rate, upload = true}) {
839
- // Do whatever you want with the Axios progress event
840
- },
841
-
842
- // `onDownloadProgress` allows handling of progress events for downloads
843
- // browser & node.js
844
- onDownloadProgress: function ({loaded, total, progress, bytes, estimated, rate, download = true}) {
845
- // Do whatever you want with the Axios progress event
846
- },
847
-
848
- // `maxContentLength` defines the max size of the http response content in bytes allowed in node.js
849
- maxContentLength: 2000,
850
-
851
- // `maxBodyLength` (Node only option) defines the max size of the http request content in bytes allowed
852
- maxBodyLength: 2000,
853
-
854
- // `redact` masks matching config keys when AxiosError#toJSON() is called.
855
- // Matching is case-insensitive and recursive. It does not change the request.
856
- redact: ['authorization', 'password'],
857
-
858
- // `validateStatus` defines whether to resolve or reject the promise for a given
859
- // HTTP response status code. If `validateStatus` returns `true` (or is set to `null`
860
- // or `undefined`), the promise will be resolved; otherwise, the promise will be
861
- // rejected.
862
- validateStatus: function (status) {
863
- return status >= 200 && status < 300; // default
864
- },
865
-
866
- // `maxRedirects` defines the maximum number of redirects to follow in node.js.
867
- // If set to 0, no redirects will be followed.
868
- maxRedirects: 21, // default
869
-
870
- // `beforeRedirect` defines a function that will be called before redirect.
871
- // Use this to adjust the request options upon redirecting,
872
- // to inspect the latest response headers,
873
- // or to cancel the request by throwing an error
874
- // If maxRedirects is set to 0, `beforeRedirect` is not used.
875
-
876
- beforeRedirect: (options, { headers }) => {
877
- if (
878
- options.hostname === "example.com" &&
879
- options.protocol === "https:"
880
- ) {
881
- options.auth = "user:password";
882
- }
883
- },
884
- // Security note:
885
- // The `beforeRedirect` hook runs after sensitive headers are stripped during redirects.
886
- //The `follow-redirects` library removes credentials on protocol downgrade (HTTPS → HTTP) for security.
887
- //Since `beforeRedirect` runs after this, re-injecting credentials without checking the protocol can expose sensitive data.
888
- //Always ensure credentials are only added for trusted HTTPS destinations.
889
-
890
- // Security note:
891
- // The beforeRedirect hook runs after sensitive headers are stripped during redirects.
892
- // Re-injecting credentials without checking the destination can expose sensitive data.
893
- // Only add credentials for trusted HTTPS destinations.
894
- // Avoid re-adding credentials on downgraded redirects.
895
-
896
-
897
- // `socketPath` defines a UNIX Socket to be used in node.js.
898
- // e.g. '/var/run/docker.sock' to send requests to the docker daemon.
899
- // Only either `socketPath` or `proxy` can be specified.
900
- // If both are specified, `socketPath` is used.
901
- //
902
- // Security: when `socketPath` is set, hostname/port of the URL are ignored,
903
- // which bypasses hostname-based SSRF protections. Never derive `socketPath`
904
- // from untrusted input. Use `allowedSocketPaths` (below) to restrict accepted
905
- // socket paths for defense-in-depth.
906
- socketPath: null, // default
907
-
908
- // `allowedSocketPaths` restricts which `socketPath` values are accepted.
909
- // Accepts a string or array of strings. Entries and the incoming socketPath
910
- // are compared after path.resolve(). A mismatch throws AxiosError with code
911
- // `ERR_BAD_OPTION_VALUE`. When null/undefined, no restriction is applied.
912
- allowedSocketPaths: null, // default
913
-
914
- // `transport` determines the transport method that will be used to make the request.
915
- // If defined, it will be used. Otherwise, if `maxRedirects` is 0,
916
- // the default `http` or `https` library will be used, depending on the protocol specified in `protocol`.
917
- // Otherwise, the `httpFollow` or `httpsFollow` library will be used, again depending on the protocol,
918
- // which can handle redirects.
919
- transport: undefined, // default
920
-
921
- // `httpAgent` and `httpsAgent` define a custom agent to be used when performing http
922
- // and https requests, respectively, in node.js. This allows options to be added like
923
- // `keepAlive` that are not enabled by default before Node.js v19.0.0. After Node.js
924
- // v19.0.0, you no longer need to customize the agent to enable `keepAlive` because
925
- // `http.globalAgent` has `keepAlive` enabled by default.
926
- httpAgent: new http.Agent({ keepAlive: true }),
927
- httpsAgent: new https.Agent({ keepAlive: true }),
928
-
929
- // `proxy` defines the hostname, port, and protocol of the proxy server.
930
- // You can also define your proxy using the conventional `http_proxy` and
931
- // `https_proxy` environment variables. If you are using environment variables
932
- // for your proxy configuration, you can also define a `no_proxy` environment
933
- // variable as a comma-separated list of domains that should not be proxied.
934
- // Use `false` to disable proxies, ignoring environment variables.
935
- // `auth` indicates that HTTP Basic auth should be used to connect to the proxy, and
936
- // supplies credentials.
937
- // This will set a `Proxy-Authorization` header, overwriting any existing
938
- // `Proxy-Authorization` custom headers you have set using `headers`.
939
- // If the proxy server uses HTTPS, then you must set the protocol to `https`.
940
- // A user-supplied `Host` header in `headers` is preserved when forwarding
941
- // through a proxy (case-insensitive match on `host`/`Host`/`HOST`); this
942
- // lets you target a virtual host that differs from the request URL — for
943
- // example, hitting `127.0.0.1:4000` while having the proxy treat the
944
- // request as `example.com`. If no `Host` header is supplied, axios
945
- // defaults it to the request URL's `hostname:port` as before.
946
- proxy: {
947
- protocol: 'https',
948
- host: '127.0.0.1',
949
- // hostname: '127.0.0.1' // Takes precedence over 'host' if both are defined
950
- port: 9000,
951
- auth: {
952
- username: 'mikeymike',
953
- password: 'rapunz3l'
954
- }
955
- },
956
-
957
- // `cancelToken` specifies a cancel token that can be used to cancel the request
958
- // (see Cancellation section below for details)
959
- cancelToken: new CancelToken(function (cancel) {
960
- }),
961
-
962
- // an alternative way to cancel Axios requests using AbortController
963
- signal: new AbortController().signal,
964
-
965
- // `decompress` indicates whether or not the response body should be decompressed
966
- // automatically. If set to `true` will also remove the 'content-encoding' header
967
- // from the responses objects of all decompressed responses
968
- // - Node only (XHR cannot turn off decompression)
969
- decompress: true, // default
970
-
971
- // `insecureHTTPParser` boolean.
972
- // Indicates where to use an insecure HTTP parser that accepts invalid HTTP headers.
973
- // This may allow interoperability with non-conformant HTTP implementations.
974
- // Using the insecure parser should be avoided.
975
- // see options https://nodejs.org/dist/latest-v12.x/docs/api/http.html#http_http_request_url_options_callback
976
- // see also https://nodejs.org/en/blog/vulnerability/february-2020-security-releases/#strict-http-header-parsing-none
977
- insecureHTTPParser: undefined, // default
978
-
979
- // transitional options for backward compatibility that may be removed in the newer versions
980
- transitional: {
981
- // silent JSON parsing mode
982
- // `true` - ignore JSON parsing errors and set response.data to null if parsing failed (old behaviour)
983
- // `false` - throw SyntaxError if JSON parsing failed
984
- // Important: this option only takes effect when `responseType` is explicitly set to 'json'.
985
- // When `responseType` is omitted (defaults to no value), axios uses `forcedJSONParsing`
986
- // to attempt JSON parsing, but will silently return the raw string on failure regardless
987
- // of this setting. To have invalid JSON throw errors, use:
988
- // { responseType: 'json', transitional: { silentJSONParsing: false } }
989
- silentJSONParsing: true, // default value for the current Axios version
990
-
991
- // try to parse the response string as JSON even if `responseType` is not 'json'
992
- forcedJSONParsing: true,
993
-
994
- // throw ETIMEDOUT error instead of generic ECONNABORTED on request timeouts
995
- clarifyTimeoutError: false,
996
-
997
- // use the legacy interceptor request/response ordering
998
- legacyInterceptorReqResOrdering: true, // default
999
- },
1000
-
1001
- env: {
1002
- // The FormData class to be used to automatically serialize the payload into a FormData object
1003
- FormData: window?.FormData || global?.FormData
1004
- },
1005
-
1006
- formSerializer: {
1007
- visitor: (value, key, path, helpers) => {}; // custom visitor function to serialize form values
1008
- dots: boolean; // use dots instead of brackets format
1009
- metaTokens: boolean; // keep special endings like {} in parameter key
1010
- indexes: boolean; // array indexes format null - no brackets, false - empty brackets, true - brackets with indexes
1011
- maxDepth: 100; // maximum object nesting depth; throws AxiosError (ERR_FORM_DATA_DEPTH_EXCEEDED) if exceeded. Set to Infinity to disable.
1012
- },
1013
-
1014
- // http adapter only (node.js)
1015
- maxRate: [
1016
- 100 * 1024, // 100KB/s upload limit,
1017
- 100 * 1024 // 100KB/s download limit
1018
- ]
1019
- }
1020
- ```
1021
-
1022
- ### Strict RFC 3986 percent-encoding for query params
1023
-
1024
- 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.
1025
-
1026
- Override the default encoder via `paramsSerializer.encode`:
1027
-
1028
- ```js
1029
- // Per-request: emit strict RFC 3986 percent-encoding for query values
1030
- axios.get('/foo', {
1031
- params: { filter: JSON.stringify({ startedAt: '2026-01-23' }) },
1032
- paramsSerializer: { encode: encodeURIComponent }
1033
- });
1034
-
1035
- // Or set it on the instance defaults
1036
- const client = axios.create({
1037
- paramsSerializer: { encode: encodeURIComponent }
1038
- });
1039
- ```
1040
-
1041
- ## 🔥 HTTP/2 Support
1042
-
1043
- Axios has experimental HTTP/2 support available via the Node.js HTTP adapter.
1044
-
1045
- Support depends on the runtime environment and Node.js version. Features like redirects and some behaviors may not be fully supported with HTTP/2.
1046
-
1047
- Options like `httpVersion` and `http2Options` are adapter-specific and may not work consistently across all environments.
1048
-
1049
- If HTTP/2 functionality is required, ensure your runtime environment supports it or consider using alternative libraries or custom adapters.
1050
-
1051
- ## Response Schema
1052
-
1053
- The response to a request contains the following information.
1054
-
1055
- ```js
1056
- {
1057
- // `data` is the response that was provided by the server
1058
- data: {},
1059
-
1060
- // `status` is the HTTP status code from the server response
1061
- status: 200,
1062
-
1063
- // `statusText` is the HTTP status message from the server response
1064
- statusText: 'OK',
1065
-
1066
- // `headers` the HTTP headers that the server responded with
1067
- // All header names are lowercase and can be accessed using the bracket notation.
1068
- // Example: `response.headers['content-type']`
1069
- headers: {},
1070
-
1071
- // `config` is the config that was provided to `axios` for the request
1072
- config: {},
1073
-
1074
- // `request` is the request that generated this response
1075
- // It is the last ClientRequest instance in node.js (in redirects)
1076
- // and an XMLHttpRequest instance in the browser
1077
- request: {}
1078
- }
1079
- ```
1080
-
1081
- When using `then`, you will receive the response as follows:
1082
-
1083
- ```js
1084
- const response = await axios.get('/user/12345');
1085
- console.log(response.data);
1086
- console.log(response.status);
1087
- console.log(response.statusText);
1088
- console.log(response.headers);
1089
- console.log(response.config);
1090
- ```
1091
-
1092
- When using `catch`, or passing a [rejection callback](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then) as second parameter of `then`, the response will be available through the `error` object as explained in the [Handling Errors](#handling-errors) section.
1093
-
1094
- ## Config Defaults
1095
-
1096
- You can specify config defaults that will be applied to every request.
1097
-
1098
- ### Global axios defaults
1099
-
1100
- ```js
1101
- axios.defaults.baseURL = 'https://api.example.com';
1102
-
1103
- // Important: If axios is used with multiple domains, the AUTH_TOKEN will be sent to all of them.
1104
- // See below for an example using Custom instance defaults instead.
1105
- axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
1106
-
1107
- axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
1108
- ```
1109
-
1110
- ### Custom instance defaults
1111
-
1112
- ```js
1113
- // Set config defaults when creating the instance
1114
- const instance = axios.create({
1115
- baseURL: 'https://api.example.com',
1116
- });
1117
-
1118
- // Alter defaults after instance has been created
1119
- instance.defaults.headers.common['Authorization'] = AUTH_TOKEN;
1120
- ```
1121
-
1122
- ### Config order of precedence
1123
-
1124
- Config will be merged with an order of precedence. The order is library defaults found in [lib/defaults/index.js](https://github.com/axios/axios/blob/main/lib/defaults/index.js#L49), then `defaults` property of the instance, and finally `config` argument for the request. The latter will take precedence over the former. Here's an example.
1125
-
1126
- ```js
1127
- // Create an instance using the config defaults provided by the library
1128
- // At this point the timeout config value is `0` as is the default for the library
1129
- const instance = axios.create();
1130
-
1131
- // Override timeout default for the library
1132
- // Now all requests using this instance will wait 2.5 seconds before timing out
1133
- instance.defaults.timeout = 2500;
1134
-
1135
- // Override timeout for this request as it's known to take a long time
1136
- instance.get('/longRequest', {
1137
- timeout: 5000,
1138
- });
1139
- ```
1140
-
1141
- ## Interceptors
1142
-
1143
- You can intercept requests or responses before methods like `.get()` or `.post()`
1144
- resolve their promises (before code inside `then` or `catch`, or after `await`)
1145
-
1146
- ```js
1147
- const instance = axios.create();
1148
-
1149
- // Add a request interceptor
1150
- instance.interceptors.request.use(
1151
- function (config) {
1152
- // Do something before the request is sent
1153
- return config;
1154
- },
1155
- function (error) {
1156
- // Do something with the request error
1157
- return Promise.reject(error);
1158
- }
1159
- );
1160
-
1161
- // Add a response interceptor
1162
- instance.interceptors.response.use(
1163
- function (response) {
1164
- // Any status code that lies within the range of 2xx causes this function to trigger
1165
- // Do something with response data
1166
- return response;
1167
- },
1168
- function (error) {
1169
- // Any status codes that fall outside the range of 2xx cause this function to trigger
1170
- // Do something with response error
1171
- return Promise.reject(error);
1172
- }
1173
- );
1174
- ```
1175
-
1176
- If you need to remove an interceptor later you can.
1177
-
1178
- ```js
1179
- const instance = axios.create();
1180
- const myInterceptor = instance.interceptors.request.use(function () {
1181
- /*...*/
1182
- });
1183
- axios.interceptors.request.eject(myInterceptor);
1184
- ```
1185
-
1186
- You can also clear all interceptors for requests or responses.
1187
-
1188
- ```js
1189
- const instance = axios.create();
1190
- instance.interceptors.request.use(function () {
1191
- /*...*/
1192
- });
1193
- instance.interceptors.request.clear(); // Removes interceptors from requests
1194
- instance.interceptors.response.use(function () {
1195
- /*...*/
1196
- });
1197
- instance.interceptors.response.clear(); // Removes interceptors from responses
1198
- ```
1199
-
1200
- You can add interceptors to a custom instance of axios.
1201
-
1202
- ```js
1203
- const instance = axios.create();
1204
- instance.interceptors.request.use(function () {
1205
- /*...*/
1206
- });
1207
- ```
1208
-
1209
- When you add request interceptors, they are presumed to be asynchronous by default. This can cause a delay
1210
- in the execution of your axios request when the main thread is blocked (a promise is created under the hood for
1211
- 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
1212
- to the options object that will tell axios to run the code synchronously and avoid any delays in request execution.
1213
-
1214
- ```js
1215
- axios.interceptors.request.use(
1216
- function (config) {
1217
- config.headers.test = 'I am only a header!';
1218
- return config;
1219
- },
1220
- null,
1221
- { synchronous: true }
1222
- );
1223
- ```
1224
-
1225
- If you want to execute a particular interceptor based on a runtime check,
1226
- you can add a `runWhen` function to the options object. The request interceptor will not be executed **if and only if** the return
1227
- of `runWhen` is `false`. The function will be called with the config
1228
- object (don't forget that you can bind your own arguments to it as well.) This can be handy when you have an
1229
- asynchronous request interceptor that only needs to run at certain times.
1230
-
1231
- ```js
1232
- function onGetCall(config) {
1233
- return config.method === 'get';
1234
- }
1235
- axios.interceptors.request.use(
1236
- function (config) {
1237
- config.headers.test = 'special get headers';
1238
- return config;
1239
- },
1240
- null,
1241
- { runWhen: onGetCall }
1242
- );
1243
- ```
1244
-
1245
- > **Note:** The options parameter(having `synchronous` and `runWhen` properties) is only supported for request interceptors at the moment.
1246
-
1247
- ### Interceptor Execution Order
1248
-
1249
- **Important:** Interceptors have different execution orders depending on their type!
1250
-
1251
- Request interceptors are executed in **reverse order** (LIFO - Last In, First Out). This means the _last_ interceptor added is executed **first**.
1252
-
1253
- Response interceptors are executed in the **order they were added** (FIFO - First In, First Out). This means the _first_ interceptor added is executed **first**.
1254
-
1255
- Example:
1256
-
1257
- ```js
1258
- const instance = axios.create();
1259
-
1260
- const interceptor = (id) => (base) => {
1261
- console.log(id);
1262
- return base;
1263
- };
1264
-
1265
- instance.interceptors.request.use(interceptor('Request Interceptor 1'));
1266
- instance.interceptors.request.use(interceptor('Request Interceptor 2'));
1267
- instance.interceptors.request.use(interceptor('Request Interceptor 3'));
1268
- instance.interceptors.response.use(interceptor('Response Interceptor 1'));
1269
- instance.interceptors.response.use(interceptor('Response Interceptor 2'));
1270
- instance.interceptors.response.use(interceptor('Response Interceptor 3'));
1271
-
1272
- // Console output:
1273
- // Request Interceptor 3
1274
- // Request Interceptor 2
1275
- // Request Interceptor 1
1276
- // [HTTP request is made]
1277
- // Response Interceptor 1
1278
- // Response Interceptor 2
1279
- // Response Interceptor 3
1280
- ```
1281
-
1282
- ### Multiple Interceptors
1283
-
1284
- Given that you add multiple response interceptors
1285
- and when the response was fulfilled
1286
-
1287
- - then each interceptor is executed
1288
- - then they are executed in the order they were added
1289
- - then only the last interceptor's result is returned
1290
- - then every interceptor receives the result of its predecessor
1291
- - and when the fulfillment-interceptor throws
1292
- - then the following fulfillment-interceptor is not called
1293
- - then the following rejection-interceptor is called
1294
- - once caught, another following fulfill-interceptor is called again (just like in a promise chain).
1295
-
1296
- Read [the interceptor tests](./test/specs/interceptors.spec.js) to see all this in code.
1297
-
1298
- ## Error Types
1299
-
1300
- There are many different axios error messages that can appear which can provide basic information about the specifics of the error and where opportunities may lie in debugging.
1301
-
1302
- The general structure of axios errors is as follows:
1303
- | Property | Definition |
1304
- | -------- | ---------- |
1305
- | message | A quick summary of the error message and the status it failed with. |
1306
- | name | This defines where the error originated from. For axios, it will always be an 'AxiosError'. |
1307
- | stack | Provides the stack trace of the error. |
1308
- | config | An axios config object with specific instance configurations defined by the user from when the request was made |
1309
- | code | Represents an axios identified error. The table below lists specific definitions for internal axios error. |
1310
- | status | HTTP response status code. See [here](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes) for common HTTP response status code meanings.
1311
-
1312
- Below is a list of potential axios identified error:
1313
-
1314
- | Code | Definition |
1315
- | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1316
- | ERR_BAD_OPTION_VALUE | Invalid value provided in axios configuration. |
1317
- | ERR_BAD_OPTION | Invalid option provided in axios configuration. |
1318
- | ERR_NOT_SUPPORT | Feature or method not supported in the current axios environment. |
1319
- | ERR_DEPRECATED | Deprecated feature or method used in axios. |
1320
- | ERR_INVALID_URL | Invalid URL provided for axios request. |
1321
- | ECONNABORTED | Typically indicates that the request has been timed out (unless `transitional.clarifyTimeoutError` is set) or aborted by the browser or its plugin. |
1322
- | ERR_CANCELED | Feature or method is canceled explicitly by the user using an AbortSignal (or a CancelToken). |
1323
- | ETIMEDOUT | Request timed out due to exceeding the default axios timelimit. `transitional.clarifyTimeoutError` must be set to `true`, otherwise a generic `ECONNABORTED` error will be thrown instead. |
1324
- | ERR_NETWORK | Network-related issue. In the browser, this error can also be caused by a [CORS](https://developer.mozilla.org/ru/docs/Web/HTTP/Guides/CORS) or [Mixed Content](https://developer.mozilla.org/en-US/docs/Web/Security/Mixed_content) policy violation. The browser does not allow the JS code to clarify the real reason for the error caused by security issues, so please check the console. |
1325
- | ERR_FR_TOO_MANY_REDIRECTS | Request is redirected too many times; exceeds max redirects specified in axios configuration. |
1326
- | ERR_BAD_RESPONSE | Response cannot be parsed properly or is in an unexpected format. Usually related to a response with `5xx` status code. |
1327
- | ERR_BAD_REQUEST | The request has an unexpected format or is missing required parameters. Usually related to a response with `4xx` status code. |
1328
-
1329
- ## Handling Errors
1330
-
1331
- The default behavior is to reject every response that returns with a status code that falls out of the range of 2xx and treat it as an error.
1332
-
1333
- ```js
1334
- axios.get('/user/12345').catch(function (error) {
1335
- if (error.response) {
1336
- // The request was made and the server responded with a status code
1337
- // that falls out of the range of 2xx
1338
- console.log(error.response.data);
1339
- console.log(error.response.status);
1340
- console.log(error.response.headers);
1341
- } else if (error.request) {
1342
- // The request was made but no response was received
1343
- // `error.request` is an instance of XMLHttpRequest in the browser and an instance of
1344
- // http.ClientRequest in node.js
1345
- console.log(error.request);
1346
- } else {
1347
- // Something happened in setting up the request that triggered an Error
1348
- console.log('Error', error.message);
1349
- }
1350
- console.log(error.config);
1351
- });
1352
- ```
1353
-
1354
- Using the `validateStatus` config option, you can override the default condition (status >= 200 && status < 300) and define HTTP code(s) that should throw an error.
1355
-
1356
- ```js
1357
- axios.get('/user/12345', {
1358
- validateStatus: function (status) {
1359
- return status < 500; // Resolve only if the status code is less than 500
1360
- },
1361
- });
1362
- ```
1363
-
1364
- Using `toJSON` you get an object with more information about the HTTP error.
1365
-
1366
- ```js
1367
- axios.get('/user/12345').catch(function (error) {
1368
- console.log(error.toJSON());
1369
- });
1370
- ```
1371
-
1372
- To avoid logging secrets from `error.config`, pass a `redact` array in the request config. Matching config keys are masked case-insensitively at any depth when `AxiosError#toJSON()` is called.
1373
-
1374
- ```js
1375
- axios.get('/user/12345', {
1376
- headers: { Authorization: 'Bearer token' },
1377
- redact: ['authorization']
1378
- }).catch(function (error) {
1379
- console.log(error.toJSON().config.headers.Authorization); // [REDACTED ****]
1380
- });
1381
- ```
1382
-
1383
- ## Handling Timeouts
1384
-
1385
- ```js
1386
- async function fetchWithTimeout() {
1387
- try {
1388
- const response = await axios.get('https://example.com/data', {
1389
- timeout: 5000, // 5 seconds
1390
- transitional: {
1391
- // set to true if you prefer ETIMEDOUT over ECONNABORTED
1392
- clarifyTimeoutError: false,
1393
- },
1394
- });
1395
-
1396
- console.log('Response:', response.data);
1397
- } catch (error) {
1398
- if (axios.isAxiosError(error)) {
1399
- if (error.code === 'ECONNABORTED' || error.code === 'ETIMEDOUT') {
1400
- console.error('Request timed out. Please try again.');
1401
- return;
1402
- }
1403
-
1404
- console.error('Axios error:', error.message);
1405
- return;
1406
- }
1407
-
1408
- console.error('Unexpected error:', error);
1409
- }
1410
- }
1411
- ```
1412
-
1413
- ## Cancellation
1414
-
1415
- ### AbortController
1416
-
1417
- Starting from `v0.22.0` Axios supports AbortController to cancel requests in a fetch API way:
1418
-
1419
- ```js
1420
- const controller = new AbortController();
1421
-
1422
- axios
1423
- .get('/foo/bar', {
1424
- signal: controller.signal,
1425
- })
1426
- .then(function (response) {
1427
- //...
1428
- });
1429
- // cancel the request
1430
- controller.abort();
1431
- ```
1432
-
1433
- ### CancelToken `👎deprecated`
1434
-
1435
- You can also cancel a request using a _CancelToken_.
1436
-
1437
- > The axios cancel token API is based on the withdrawn [cancellable promises proposal](https://github.com/tc39/proposal-cancelable-promises).
1438
-
1439
- > This API is deprecated since v0.22.0 and shouldn't be used in new projects
1440
-
1441
- You can create a cancel token using the `CancelToken.source` factory as shown below:
1442
-
1443
- ```js
1444
- const CancelToken = axios.CancelToken;
1445
- const source = CancelToken.source();
1446
-
1447
- axios
1448
- .get('/user/12345', {
1449
- cancelToken: source.token,
1450
- })
1451
- .catch(function (thrown) {
1452
- if (axios.isCancel(thrown)) {
1453
- console.log('Request canceled', thrown.message);
1454
- } else {
1455
- // handle error
1456
- }
1457
- });
1458
-
1459
- axios.post(
1460
- '/user/12345',
1461
- {
1462
- name: 'new name',
1463
- },
1464
- {
1465
- cancelToken: source.token,
1466
- }
1467
- );
1468
-
1469
- // cancel the request (the message parameter is optional)
1470
- source.cancel('Operation canceled by the user.');
1471
- ```
1472
-
1473
- You can also create a cancel token by passing an executor function to the `CancelToken` constructor:
1474
-
1475
- ```js
1476
- const CancelToken = axios.CancelToken;
1477
- let cancel;
1478
-
1479
- axios.get('/user/12345', {
1480
- cancelToken: new CancelToken(function executor(c) {
1481
- // An executor function receives a cancel function as a parameter
1482
- cancel = c;
1483
- }),
1484
- });
1485
-
1486
- // cancel the request
1487
- cancel();
1488
- ```
1489
-
1490
- > **Note:** you can cancel several requests with the same cancel token/abort controller.
1491
- > If a cancellation token is already cancelled at the moment of starting an Axios request, then the request is cancelled immediately, without any attempts to make a real request.
1492
-
1493
- > During the transition period, you can use both cancellation APIs, even for the same request:
1494
-
1495
- ## Using `application/x-www-form-urlencoded` format
1496
-
1497
- ### URLSearchParams
1498
-
1499
- By default, axios serializes JavaScript objects to `JSON`. To send data in the [`application/x-www-form-urlencoded`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) format instead, you can use the [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams) API, which is [supported](http://www.caniuse.com/#feat=urlsearchparams) in the vast majority of browsers, and [Node](https://nodejs.org/api/url.html#url_class_urlsearchparams) starting with v10 (released in 2018).
1500
-
1501
- ```js
1502
- const params = new URLSearchParams({ foo: 'bar' });
1503
- params.append('extraparam', 'value');
1504
- axios.post('/foo', params);
1505
- ```
1506
-
1507
- ### Query string (Older browsers)
1508
-
1509
- For compatibility with very old browsers, there is a [polyfill](https://github.com/WebReflection/url-search-params) available (make sure to polyfill the global environment).
1510
-
1511
- Alternatively, you can encode data using the [`qs`](https://github.com/ljharb/qs) library:
1512
-
1513
- ```js
1514
- const qs = require('qs');
1515
- axios.post('/foo', qs.stringify({ bar: 123 }));
1516
- ```
1517
-
1518
- Or in another way (ES6),
1519
-
1520
- ```js
1521
- import qs from 'qs';
1522
- const data = { bar: 123 };
1523
- const options = {
1524
- method: 'POST',
1525
- headers: { 'content-type': 'application/x-www-form-urlencoded' },
1526
- data: qs.stringify(data),
1527
- url,
1528
- };
1529
- axios(options);
1530
- ```
1531
-
1532
- ### Older Node.js versions
1533
-
1534
- For older Node.js engines, you can use the [`querystring`](https://nodejs.org/api/querystring.html) module as follows:
1535
-
1536
- ```js
1537
- const querystring = require('querystring');
1538
- axios.post('https://something.com/', querystring.stringify({ foo: 'bar' }));
1539
- ```
1540
-
1541
- You can also use the [`qs`](https://github.com/ljharb/qs) library.
1542
-
1543
- > **Note**: The `qs` library is preferable if you need to stringify nested objects, as the `querystring` method has [known issues](https://github.com/nodejs/node-v0.x-archive/issues/1665) with that use case.
1544
-
1545
- ### 🆕 Automatic serialization to URLSearchParams
1546
-
1547
- Axios will automatically serialize the data object to urlencoded format if the content-type header is set to "application/x-www-form-urlencoded".
1548
-
1549
- ```js
1550
- const data = {
1551
- x: 1,
1552
- arr: [1, 2, 3],
1553
- arr2: [1, [2], 3],
1554
- users: [
1555
- { name: 'Peter', surname: 'Griffin' },
1556
- { name: 'Thomas', surname: 'Anderson' },
1557
- ],
1558
- };
1559
-
1560
- await axios.postForm('https://postman-echo.com/post', data, {
1561
- headers: { 'content-type': 'application/x-www-form-urlencoded' },
1562
- });
1563
- ```
1564
-
1565
- The server will handle it as:
1566
-
1567
- ```js
1568
- {
1569
- x: '1',
1570
- 'arr[]': [ '1', '2', '3' ],
1571
- 'arr2[0]': '1',
1572
- 'arr2[1][0]': '2',
1573
- 'arr2[2]': '3',
1574
- 'arr3[]': [ '1', '2', '3' ],
1575
- 'users[0][name]': 'Peter',
1576
- 'users[0][surname]': 'griffin',
1577
- 'users[1][name]': 'Thomas',
1578
- 'users[1][surname]': 'Anderson'
1579
- }
1580
- ```
1581
-
1582
- If your backend body-parser (like `body-parser` of `express.js`) supports nested objects decoding, you will get the same object on the server-side automatically
1583
-
1584
- ```js
1585
- const app = express();
1586
-
1587
- app.use(bodyParser.urlencoded({ extended: true })); // support encoded bodies
1588
-
1589
- app.post('/', function (req, res, next) {
1590
- // echo body as JSON
1591
- res.send(JSON.stringify(req.body));
1592
- });
1593
-
1594
- server = app.listen(3000);
1595
- ```
1596
-
1597
- ## Using `multipart/form-data` format
1598
-
1599
- ### FormData
1600
-
1601
- To send the data as a `multipart/form-data` you need to pass a formData instance as a payload.
1602
- Setting the `Content-Type` header is not required as Axios guesses it based on the payload type.
1603
-
1604
- ```js
1605
- const formData = new FormData();
1606
- formData.append('foo', 'bar');
1607
-
1608
- axios.post('https://httpbin.org/post', formData);
1609
- ```
1610
-
1611
- In node.js, you can use the [`form-data`](https://github.com/form-data/form-data) library as follows:
1612
-
1613
- ```js
1614
- const FormData = require('form-data');
1615
-
1616
- const form = new FormData();
1617
- form.append('my_field', 'my value');
1618
- form.append('my_buffer', Buffer.alloc(10));
1619
- form.append('my_file', fs.createReadStream('/foo/bar.jpg'));
1620
-
1621
- axios.post('https://example.com', form);
1622
- ```
1623
-
1624
- In node.js, when a `FormData` object provides `getHeaders()`, axios copies all returned headers by default for v1 compatibility. If the `FormData` object is custom or not fully trusted, set `formDataHeaderPolicy: 'content-only'` to copy only `Content-Type` and `Content-Length`, and set any other request headers explicitly with the request `headers` config.
1625
-
1626
- ### 🆕 Automatic serialization to FormData
1627
-
1628
- Starting from `v0.27.0`, Axios supports automatic object serialization to a FormData object if the request `Content-Type`
1629
- header is set to `multipart/form-data`.
1630
-
1631
- The following request will submit the data in a FormData format (Browser & Node.js):
1632
-
1633
- ```js
1634
- import axios from 'axios';
1635
-
1636
- axios
1637
- .post(
1638
- 'https://httpbin.org/post',
1639
- { x: 1 },
1640
- {
1641
- headers: {
1642
- 'Content-Type': 'multipart/form-data',
1643
- },
1644
- }
1645
- )
1646
- .then(({ data }) => console.log(data));
1647
- ```
1648
-
1649
- In the `node.js` build, the ([`form-data`](https://github.com/form-data/form-data)) polyfill is used by default.
1650
-
1651
- You can overload the FormData class by setting the `env.FormData` config variable,
1652
- but you probably won't need it in most cases:
1653
-
1654
- ```js
1655
- const axios = require('axios');
1656
- var FormData = require('form-data');
1657
-
1658
- axios
1659
- .post(
1660
- 'https://httpbin.org/post',
1661
- { x: 1, buf: Buffer.alloc(10) },
1662
- {
1663
- headers: {
1664
- 'Content-Type': 'multipart/form-data',
1665
- },
1666
- }
1667
- )
1668
- .then(({ data }) => console.log(data));
1669
- ```
1670
-
1671
- Axios FormData serializer supports some special endings to perform the following operations:
1672
-
1673
- - `{}` - serialize the value with JSON.stringify
1674
- - `[]` - unwrap the array-like object as separate fields with the same key
1675
-
1676
- > **Note**: unwrap/expand operation will be used by default on arrays and FileList objects
1677
-
1678
- FormData serializer supports additional options via `config.formSerializer: object` property to handle rare cases:
1679
-
1680
- - `visitor: Function` - user-defined visitor function that will be called recursively to serialize the data object
1681
- to a `FormData` object by following custom rules.
1682
-
1683
- - `dots: boolean = false` - use dot notation instead of brackets to serialize arrays and objects;
1684
-
1685
- - `metaTokens: boolean = true` - add the special ending (e.g `user{}: '{"name": "John"}'`) in the FormData key.
1686
- The back-end body-parser could potentially use this meta-information to automatically parse the value as JSON.
1687
-
1688
- - `indexes: null|false|true = false` - controls how indexes will be added to unwrapped keys of `flat` array-like objects.
1689
- - `null` - don't add brackets (`arr: 1`, `arr: 2`, `arr: 3`)
1690
- - `false`(default) - add empty brackets (`arr[]: 1`, `arr[]: 2`, `arr[]: 3`)
1691
- - `true` - add brackets with indexes (`arr[0]: 1`, `arr[1]: 2`, `arr[2]: 3`)
1692
- - `maxDepth: number = 100` - maximum object nesting depth the serializer will recurse into. If the
1693
- input object exceeds this depth, an `AxiosError` with `code: 'ERR_FORM_DATA_DEPTH_EXCEEDED'` is
1694
- thrown instead of overflowing the call stack. This protects server-side applications from DoS
1695
- attacks via deeply nested payloads. Set to `Infinity` to disable the limit and restore pre-fix behaviour.
1696
-
1697
- ```js
1698
- // Raise the limit for a schema that genuinely nests deeper than 100 levels:
1699
- axios.postForm('/api', data, { formSerializer: { maxDepth: 200 } });
1700
-
1701
- // Same protection applies to params serialization:
1702
- axios.get('/api', { params: data, paramsSerializer: { maxDepth: 200 } });
1703
- ```
1704
-
1705
- Let's say we have an object like this one:
1706
-
1707
- ```js
1708
- const obj = {
1709
- x: 1,
1710
- arr: [1, 2, 3],
1711
- arr2: [1, [2], 3],
1712
- users: [
1713
- { name: 'Peter', surname: 'Griffin' },
1714
- { name: 'Thomas', surname: 'Anderson' },
1715
- ],
1716
- 'obj2{}': [{ x: 1 }],
1717
- };
1718
- ```
1719
-
1720
- The following steps will be executed by the Axios serializer internally:
1721
-
1722
- ```js
1723
- const formData = new FormData();
1724
- formData.append('x', '1');
1725
- formData.append('arr[]', '1');
1726
- formData.append('arr[]', '2');
1727
- formData.append('arr[]', '3');
1728
- formData.append('arr2[0]', '1');
1729
- formData.append('arr2[1][0]', '2');
1730
- formData.append('arr2[2]', '3');
1731
- formData.append('users[0][name]', 'Peter');
1732
- formData.append('users[0][surname]', 'Griffin');
1733
- formData.append('users[1][name]', 'Thomas');
1734
- formData.append('users[1][surname]', 'Anderson');
1735
- formData.append('obj2{}', '[{"x":1}]');
1736
- ```
1737
-
1738
- Axios supports the following shortcut methods: `postForm`, `putForm`, `patchForm`
1739
- which are just the corresponding http methods with the `Content-Type` header preset to `multipart/form-data`.
1740
-
1741
- ## Files Posting
1742
-
1743
- You can easily submit a single file:
1744
-
1745
- ```js
1746
- await axios.postForm('https://httpbin.org/post', {
1747
- myVar: 'foo',
1748
- file: document.querySelector('#fileInput').files[0],
1749
- });
1750
- ```
1751
-
1752
- or multiple files as `multipart/form-data`:
1753
-
1754
- ```js
1755
- await axios.postForm('https://httpbin.org/post', {
1756
- 'files[]': document.querySelector('#fileInput').files,
1757
- });
1758
- ```
1759
-
1760
- `FileList` object can be passed directly:
1761
-
1762
- ```js
1763
- await axios.postForm('https://httpbin.org/post', document.querySelector('#fileInput').files);
1764
- ```
1765
-
1766
- All files will be sent with the same field names: `files[]`.
1767
-
1768
- ## 🆕 HTML Form Posting (browser)
1769
-
1770
- Pass an HTML Form element as a payload to submit it as `multipart/form-data` content.
1771
-
1772
- ```js
1773
- await axios.postForm('https://httpbin.org/post', document.querySelector('#htmlForm'));
1774
- ```
1775
-
1776
- `FormData` and `HTMLForm` objects can also be posted as `JSON` by explicitly setting the `Content-Type` header to `application/json`:
1777
-
1778
- ```js
1779
- await axios.post('https://httpbin.org/post', document.querySelector('#htmlForm'), {
1780
- headers: {
1781
- 'Content-Type': 'application/json',
1782
- },
1783
- });
1784
- ```
1785
-
1786
- For example, the Form
1787
-
1788
- ```html
1789
- <form id="form">
1790
- <input type="text" name="foo" value="1" />
1791
- <input type="text" name="deep.prop" value="2" />
1792
- <input type="text" name="deep prop spaced" value="3" />
1793
- <input type="text" name="baz" value="4" />
1794
- <input type="text" name="baz" value="5" />
1795
-
1796
- <select name="user.age">
1797
- <option value="value1">Value 1</option>
1798
- <option value="value2" selected>Value 2</option>
1799
- <option value="value3">Value 3</option>
1800
- </select>
1801
-
1802
- <input type="submit" value="Save" />
1803
- </form>
1804
- ```
1805
-
1806
- will be submitted as the following JSON object:
1807
-
1808
- ```js
1809
- {
1810
- "foo": "1",
1811
- "deep": {
1812
- "prop": {
1813
- "spaced": "3"
1814
- }
1815
- },
1816
- "baz": [
1817
- "4",
1818
- "5"
1819
- ],
1820
- "user": {
1821
- "age": "value2"
1822
- }
1823
- }
1824
- ```
1825
-
1826
- Sending `Blobs`/`Files` as JSON (`base64`) is not currently supported.
1827
-
1828
- ## 🆕 Progress capturing
1829
-
1830
- Axios supports both browser and node environments to capture request upload/download progress.
1831
- The frequency of progress events is forced to be limited to `3` times per second.
1832
-
1833
- ```js
1834
- await axios.post(url, data, {
1835
- onUploadProgress: function (axiosProgressEvent) {
1836
- /*{
1837
- loaded: number;
1838
- total?: number;
1839
- progress?: number; // in range [0..1]
1840
- bytes: number; // how many bytes have been transferred since the last trigger (delta)
1841
- estimated?: number; // estimated time in seconds
1842
- rate?: number; // upload speed in bytes
1843
- upload: true; // upload sign
1844
- }*/
1845
- },
1846
-
1847
- onDownloadProgress: function (axiosProgressEvent) {
1848
- /*{
1849
- loaded: number;
1850
- total?: number;
1851
- progress?: number;
1852
- bytes: number;
1853
- estimated?: number;
1854
- rate?: number; // download speed in bytes
1855
- download: true; // download sign
1856
- }*/
1857
- },
1858
- });
1859
- ```
1860
-
1861
- You can also track stream upload/download progress in node.js:
1862
-
1863
- ```js
1864
- const { data } = await axios.post(SERVER_URL, readableStream, {
1865
- onUploadProgress: ({ progress }) => {
1866
- console.log((progress * 100).toFixed(2));
1867
- },
1868
-
1869
- headers: {
1870
- 'Content-Length': contentLength,
1871
- },
1872
-
1873
- maxRedirects: 0, // avoid buffering the entire stream
1874
- });
1875
- ```
1876
-
1877
- > **Note:**
1878
- > Capturing FormData upload progress is not currently supported in node.js environments.
1879
-
1880
- > **⚠️ Warning**
1881
- > It is recommended to disable redirects by setting maxRedirects: 0 to upload the stream in the **node.js** environment,
1882
- > as the follow-redirects package will buffer the entire stream in RAM without following the "backpressure" algorithm.
1883
-
1884
- ## 🆕 Rate limiting
1885
-
1886
- Download and upload rate limits can only be set for the http adapter (node.js):
1887
-
1888
- ```js
1889
- const { data } = await axios.post(LOCAL_SERVER_URL, myBuffer, {
1890
- onUploadProgress: ({ progress, rate }) => {
1891
- console.log(`Upload [${(progress * 100).toFixed(2)}%]: ${(rate / 1024).toFixed(2)}KB/s`);
1892
- },
1893
-
1894
- maxRate: [100 * 1024], // 100KB/s limit
1895
- });
1896
- ```
1897
-
1898
- ## 🆕 AxiosHeaders
1899
-
1900
- Axios has its own `AxiosHeaders` class to manipulate headers using a Map-like API that guarantees caseless work.
1901
- Although HTTP is case-insensitive in headers, Axios will retain the case of the original header for stylistic reasons
1902
- and as a workaround when servers mistakenly consider the header's case.
1903
- The old approach of directly manipulating the headers object is still available, but deprecated and not recommended for future usage.
1904
-
1905
- ### Working with headers
1906
-
1907
- An AxiosHeaders object instance can contain different types of internal values. that control setting and merging logic.
1908
- The final headers object with string values is obtained by Axios by calling the `toJSON` method.
1909
-
1910
- > Note: By JSON here we mean an object consisting only of string values intended to be sent over the network.
1911
-
1912
- The header value can be one of the following types:
1913
-
1914
- - `string` - normal string value that will be sent to the server
1915
- - `null` - skip header when rendering to JSON
1916
- - `false` - skip header when rendering to JSON, additionally indicates that `set` method must be called with `rewrite` option set to `true`
1917
- to overwrite this value (Axios uses this internally to allow users to opt out of installing certain headers like `User-Agent` or `Content-Type`)
1918
- - `undefined` - value is not set
1919
-
1920
- > Note: The header value is considered set if it is not equal to undefined.
1921
-
1922
- The headers object is always initialized inside interceptors and transformers:
1923
-
1924
- ```ts
1925
- axios.interceptors.request.use((request: InternalAxiosRequestConfig) => {
1926
- request.headers.set('My-header', 'value');
1927
-
1928
- request.headers.set({
1929
- 'My-set-header1': 'my-set-value1',
1930
- 'My-set-header2': 'my-set-value2',
1931
- });
1932
-
1933
- request.headers.set('User-Agent', false); // disable subsequent setting the header by Axios
1934
-
1935
- request.headers.setContentType('text/plain');
1936
-
1937
- request.headers['My-set-header2'] = 'newValue'; // direct access is deprecated
1938
-
1939
- return request;
1940
- });
1941
- ```
1942
-
1943
- You can iterate over an `AxiosHeaders` instance using a `for...of` statement:
1944
-
1945
- ```js
1946
- const headers = new AxiosHeaders({
1947
- foo: '1',
1948
- bar: '2',
1949
- baz: '3',
1950
- });
1951
-
1952
- for (const [header, value] of headers) {
1953
- console.log(header, value);
1954
- }
1955
-
1956
- // foo 1
1957
- // bar 2
1958
- // baz 3
1959
- ```
1960
-
1961
- ### Preserving a specific header case
1962
-
1963
- Header names are case-insensitive, but `AxiosHeaders` keeps the case of the first matching key it sees.
1964
- If you need a specific case for non-standard case-sensitive servers, define a case preset with `undefined` and then set the value later:
1965
-
1966
- ```js
1967
- const api = axios.create();
1968
-
1969
- api.defaults.headers.common = {
1970
- 'content-type': undefined,
1971
- accept: undefined,
1972
- };
1973
-
1974
- await api.put(url, data, {
1975
- headers: {
1976
- 'Content-Type': 'application/octet-stream',
1977
- Accept: 'application/json',
1978
- },
1979
- });
1980
- ```
1981
-
1982
- You can also compose the same behavior with `AxiosHeaders.concat`:
1983
-
1984
- ```js
1985
- const headers = axios.AxiosHeaders.concat(
1986
- { 'content-type': undefined },
1987
- { 'Content-Type': 'application/octet-stream' }
1988
- );
1989
-
1990
- await axios.put(url, data, { headers });
1991
- ```
1992
-
1993
- ### new AxiosHeaders(headers?)
1994
-
1995
- Constructs a new `AxiosHeaders` instance.
1996
-
1997
- ```
1998
- constructor(headers?: RawAxiosHeaders | AxiosHeaders | string);
1999
- ```
2000
-
2001
- If the headers object is a string, it will be parsed as RAW HTTP headers.
2002
-
2003
- ```js
2004
- const headers = new AxiosHeaders(`
2005
- Host: www.bing.com
2006
- User-Agent: curl/7.54.0
2007
- Accept: */*`);
2008
-
2009
- console.log(headers);
2010
-
2011
- // Object [AxiosHeaders] {
2012
- // host: 'www.bing.com',
2013
- // 'user-agent': 'curl/7.54.0',
2014
- // accept: '*/*'
2015
- // }
2016
- ```
2017
-
2018
- ### AxiosHeaders#set
2019
-
2020
- ```ts
2021
- set(headerName, value: Axios, rewrite?: boolean);
2022
- set(headerName, value, rewrite?: (this: AxiosHeaders, value: string, name: string, headers: RawAxiosHeaders) => boolean);
2023
- set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean);
2024
- ```
2025
-
2026
- The `rewrite` argument controls the overwriting behavior:
2027
-
2028
- - `false` - do not overwrite if the header's value is set (is not `undefined`)
2029
- - `undefined` (default) - overwrite the header unless its value is set to `false`
2030
- - `true` - rewrite anyway
2031
-
2032
- The option can also accept a user-defined function that determines whether the value should be overwritten or not.
2033
-
2034
- Returns `this`.
2035
-
2036
- ### AxiosHeaders#get(header)
2037
-
2038
- ```
2039
- get(headerName: string, matcher?: true | AxiosHeaderMatcher): AxiosHeaderValue;
2040
- get(headerName: string, parser: RegExp): RegExpExecArray | null;
2041
- ```
2042
-
2043
- Returns the internal value of the header. It can take an extra argument to parse the header's value with `RegExp.exec`,
2044
- matcher function or internal key-value parser.
2045
-
2046
- ```ts
2047
- const headers = new AxiosHeaders({
2048
- 'Content-Type': 'multipart/form-data; boundary=Asrf456BGe4h',
2049
- });
2050
-
2051
- console.log(headers.get('Content-Type'));
2052
- // multipart/form-data; boundary=Asrf456BGe4h
2053
-
2054
- console.log(headers.get('Content-Type', true)); // parse key-value pairs from a string separated with \s,;= delimiters:
2055
- // [Object: null prototype] {
2056
- // 'multipart/form-data': undefined,
2057
- // boundary: 'Asrf456BGe4h'
2058
- // }
2059
-
2060
- console.log(
2061
- headers.get('Content-Type', (value, name, headers) => {
2062
- return String(value).replace(/a/g, 'ZZZ');
2063
- })
2064
- );
2065
- // multipZZZrt/form-dZZZtZZZ; boundZZZry=Asrf456BGe4h
2066
-
2067
- console.log(headers.get('Content-Type', /boundary=(\w+)/)?.[0]);
2068
- // boundary=Asrf456BGe4h
2069
- ```
2070
-
2071
- Returns the value of the header.
2072
-
2073
- ### AxiosHeaders#has(header, matcher?)
2074
-
2075
- ```
2076
- has(header: string, matcher?: AxiosHeaderMatcher): boolean;
2077
- ```
2078
-
2079
- Returns `true` if the header is set (has no `undefined` value).
2080
-
2081
- ### AxiosHeaders#delete(header, matcher?)
2082
-
2083
- ```
2084
- delete(header: string | string[], matcher?: AxiosHeaderMatcher): boolean;
2085
- ```
2086
-
2087
- Returns `true` if at least one header has been removed.
2088
-
2089
- ### AxiosHeaders#clear(matcher?)
2090
-
2091
- ```
2092
- clear(matcher?: AxiosHeaderMatcher): boolean;
2093
- ```
2094
-
2095
- Removes all headers.
2096
- Unlike the `delete` method matcher, this optional matcher will be used to match against the header name rather than the value.
2097
-
2098
- ```ts
2099
- const headers = new AxiosHeaders({
2100
- foo: '1',
2101
- 'x-foo': '2',
2102
- 'x-bar': '3',
2103
- });
2104
-
2105
- console.log(headers.clear(/^x-/)); // true
2106
-
2107
- console.log(headers.toJSON()); // [Object: null prototype] { foo: '1' }
2108
- ```
2109
-
2110
- Returns `true` if at least one header has been cleared.
2111
-
2112
- ### AxiosHeaders#normalize(format);
2113
-
2114
- If the headers object was changed directly, it can have duplicates with the same name but in different cases.
2115
- This method normalizes the headers object by combining duplicate keys into one.
2116
- Axios uses this method internally after calling each interceptor.
2117
- Set `format` to true for converting header names to lowercase and capitalizing the initial letters (`cOntEnt-type` => `Content-Type`)
2118
-
2119
- ```js
2120
- const headers = new AxiosHeaders({
2121
- foo: '1',
2122
- });
2123
-
2124
- headers.Foo = '2';
2125
- headers.FOO = '3';
2126
-
2127
- console.log(headers.toJSON()); // [Object: null prototype] { foo: '1', Foo: '2', FOO: '3' }
2128
- console.log(headers.normalize().toJSON()); // [Object: null prototype] { foo: '3' }
2129
- console.log(headers.normalize(true).toJSON()); // [Object: null prototype] { Foo: '3' }
2130
- ```
2131
-
2132
- Returns `this`.
2133
-
2134
- ### AxiosHeaders#concat(...targets)
2135
-
2136
- ```
2137
- concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): AxiosHeaders;
2138
- ```
2139
-
2140
- Merges the instance with targets into a new `AxiosHeaders` instance. If the target is a string, it will be parsed as RAW HTTP headers.
2141
-
2142
- Returns a new `AxiosHeaders` instance.
2143
-
2144
- ### AxiosHeaders#toJSON(asStrings?)
2145
-
2146
- ```
2147
- toJSON(asStrings?: boolean): RawAxiosHeaders;
2148
- ```
2149
-
2150
- Resolve all internal header values into a new null prototype object.
2151
- Set `asStrings` to true to resolve arrays as a string containing all elements, separated by commas.
2152
-
2153
- ### AxiosHeaders.from(thing?)
2154
-
2155
- ```
2156
- from(thing?: AxiosHeaders | RawAxiosHeaders | string): AxiosHeaders;
2157
- ```
2158
-
2159
- Returns a new `AxiosHeaders` instance created from the raw headers passed in,
2160
- or simply returns the given headers object if it's an `AxiosHeaders` instance.
2161
-
2162
- ### AxiosHeaders.concat(...targets)
2163
-
2164
- ```
2165
- concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): AxiosHeaders;
2166
- ```
2167
-
2168
- Returns a new `AxiosHeaders` instance created by merging the target objects.
2169
-
2170
- ### Shortcuts
2171
-
2172
- The following shortcuts are available:
2173
-
2174
- - `setContentType`, `getContentType`, `hasContentType`
2175
-
2176
- - `setContentLength`, `getContentLength`, `hasContentLength`
2177
-
2178
- - `setAccept`, `getAccept`, `hasAccept`
2179
-
2180
- - `setUserAgent`, `getUserAgent`, `hasUserAgent`
2181
-
2182
- - `setContentEncoding`, `getContentEncoding`, `hasContentEncoding`
2183
-
2184
- ## 🔥 Fetch adapter
2185
-
2186
- Fetch adapter was introduced in `v1.7.0`. By default, it will be used if `xhr` and `http` adapters are not available in the build,
2187
- or not supported by the environment.
2188
- To use it by default, it must be selected explicitly:
2189
-
2190
- ```js
2191
- const { data } = axios.get(url, {
2192
- adapter: 'fetch', // by default ['xhr', 'http', 'fetch']
2193
- });
2194
- ```
2195
-
2196
- You can create a separate instance for this:
2197
-
2198
- ```js
2199
- const fetchAxios = axios.create({
2200
- adapter: 'fetch',
2201
- });
2202
-
2203
- const { data } = fetchAxios.get(url);
2204
- ```
2205
-
2206
- The adapter supports the same functionality as the `xhr` adapter, **including upload and download progress capturing**.
2207
- Also, it supports additional response types such as `stream` and `formdata` (if supported by the environment).
2208
-
2209
- ### 🔥 Custom fetch
2210
-
2211
- Starting from `v1.12.0`, you can customize the fetch adapter to use a custom fetch API instead of environment globals.
2212
- You can pass a custom `fetch` function, `Request`, and `Response` constructors via env config.
2213
- This can be helpful in case of custom environments & app frameworks.
2214
-
2215
- Also, when using a custom fetch, you may need to set custom Request and Response too. If you don't set them, global objects will be used.
2216
- If your custom fetch api does not have these objects, and the globals are incompatible with a custom fetch,
2217
- you must disable their use inside the fetch adapter by passing null.
2218
-
2219
- > Note: Setting `Request` & `Response` to `null` will make it impossible for the fetch adapter to capture the upload & download progress.
2220
-
2221
- Basic example:
2222
-
2223
- ```js
2224
- import customFetchFunction from 'customFetchModule';
2225
-
2226
- const instance = axios.create({
2227
- adapter: 'fetch',
2228
- onDownloadProgress(e) {
2229
- console.log('downloadProgress', e);
2230
- },
2231
- env: {
2232
- fetch: customFetchFunction,
2233
- Request: null, // undefined -> use the global constructor
2234
- Response: null,
2235
- },
2236
- });
2237
- ```
2238
-
2239
- #### 🔥 Using with Tauri
2240
-
2241
- A minimal example of setting up Axios for use in a [Tauri](https://tauri.app/plugin/http-client/) app with a platform fetch function that ignores CORS policy for requests.
2242
-
2243
- ```js
2244
- import { fetch } from '@tauri-apps/plugin-http';
2245
- import axios from 'axios';
2246
-
2247
- const instance = axios.create({
2248
- adapter: 'fetch',
2249
- onDownloadProgress(e) {
2250
- console.log('downloadProgress', e);
2251
- },
2252
- env: {
2253
- fetch,
2254
- },
2255
- });
2256
-
2257
- const { data } = await instance.get('https://google.com');
2258
- ```
2259
-
2260
- #### 🔥 Using with SvelteKit
2261
-
2262
- [SvelteKit](https://svelte.dev/docs/kit/web-standards#Fetch-APIs) framework has a custom implementation of the fetch function for server rendering (so called `load` functions), and also uses relative paths,
2263
- which makes it incompatible with the standard URL API. So, Axios must be configured to use the custom fetch API:
2264
-
2265
- ```js
2266
- export async function load({ fetch }) {
2267
- const { data: post } = await axios.get('https://jsonplaceholder.typicode.com/posts/1', {
2268
- adapter: 'fetch',
2269
- env: {
2270
- fetch,
2271
- Request: null,
2272
- Response: null,
2273
- },
2274
- });
2275
-
2276
- return { post };
2277
- }
2278
- ```
2279
-
2280
- #### HTTP/2 Support
2281
-
2282
- Axios supports HTTP/2 via the Node.js `http` adapter (introduced in v1.13.0).
2283
-
2284
- This support depends on the runtime environment. Since Axios relies on Node.js APIs, HTTP/2 functionality is available in supported Node.js versions, but may not work in other environments (such as Bun or Deno).
2285
-
2286
- Options like `httpVersion` and `http2Options` are adapter-specific and may not behave consistently across all environments.
2287
-
2288
- Note: HTTP/2 redirects are currently not supported by the HTTP/2 adapter.
2289
-
2290
- ```js
2291
- const form = new FormData();
2292
-
2293
- form.append('foo', '123');
2294
-
2295
- const { data, headers, status } = await axios.post('https://httpbin.org/post', form, {
2296
- onUploadProgress(e) {
2297
- console.log('upload progress', e);
2298
- },
2299
- onDownloadProgress(e) {
2300
- console.log('download progress', e);
2301
- },
2302
- responseType: 'arraybuffer',
2303
- });
2304
- ```
2305
-
2306
- ## Semver
2307
-
2308
- Since Axios has reached a `v.1.0.0` we will fully embrace semver as per the spec [here](https://semver.org/)
2309
-
2310
- ## Promises
2311
-
2312
- axios depends on a native ES6 Promise implementation to be [supported](https://caniuse.com/promises).
2313
- If your environment doesn't support ES6 Promises, you can [polyfill](https://github.com/jakearchibald/es6-promise).
2314
-
2315
- ## TypeScript
2316
-
2317
- axios includes [TypeScript](https://typescriptlang.org) definitions and a type guard for axios errors.
2318
-
2319
- ```typescript
2320
- let user: User = null;
2321
- try {
2322
- const { data } = await axios.get('/user?ID=12345');
2323
- user = data.userDetails;
2324
- } catch (error) {
2325
- if (axios.isAxiosError(error)) {
2326
- handleAxiosError(error);
2327
- } else {
2328
- handleUnexpectedError(error);
2329
- }
2330
- }
2331
- ```
2332
-
2333
- Because axios dual publishes with an ESM default export and a CJS `module.exports`, there are some caveats.
2334
- The recommended setting is to use `"moduleResolution": "node16"` (this is implied by `"module": "node16"`). Note that this requires TypeScript 4.7 or greater.
2335
- If use ESM, your settings should be fine.
2336
- If you compile TypeScript to CJS and you can’t use `"moduleResolution": "node 16"`, you have to enable `esModuleInterop`.
2337
- If you use TypeScript to type check CJS JavaScript code, your only option is to use `"moduleResolution": "node16"`.
2338
-
2339
- You can also create a custom instance with typed interceptors:
2340
-
2341
- ```typescript
2342
- import axios, { AxiosInstance, InternalAxiosRequestConfig } from 'axios';
2343
-
2344
- const apiClient: AxiosInstance = axios.create({
2345
- baseURL: 'https://api.example.com',
2346
- timeout: 10000,
2347
- });
2348
-
2349
- apiClient.interceptors.request.use((config: InternalAxiosRequestConfig) => {
2350
- // Add auth token
2351
- return config;
2352
- });
2353
- ```
2354
-
2355
- ## Online one-click setup
2356
-
2357
- You can use Gitpod, an online IDE(which is free for Open Source) for contributing or running the examples online.
2358
-
2359
- [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/axios/axios/blob/main/examples/server.js)
2360
-
2361
- ## Contributing
2362
-
2363
- ### Local setup
2364
-
2365
- 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.
2366
-
2367
- 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:
2368
-
2369
- ```bash
2370
- npm ci
2371
- npm rebuild husky && npx husky
2372
- ```
2373
-
2374
- Run those two commands once per fresh checkout. You do **not** need to re-run them after every subsequent `npm install`.
2375
-
2376
- Do not remove `ignore-scripts=true` from `.npmrc` to "fix" this — that re-opens the lifecycle-script attack surface for every other package in the tree. All CI workflows already invoke npm with `--ignore-scripts`, so local behaviour matches CI.
2377
-
2378
- ## Resources
2379
-
2380
- - [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
2381
- - [Ecosystem](https://github.com/axios/axios/blob/v1.x/ECOSYSTEM.md)
2382
- - [Contributing Guide](https://github.com/axios/axios/blob/v1.x/CONTRIBUTING.md)
2383
- - [Code of Conduct](https://github.com/axios/axios/blob/v1.x/CODE_OF_CONDUCT.md)
2384
-
2385
- ## Credits
2386
-
2387
- axios is heavily inspired by the [$http service](https://docs.angularjs.org/api/ng/service/$http) provided in [AngularJS](https://angularjs.org/). Ultimately axios is an effort to provide a standalone `$http`-like service for use outside of AngularJS.
2388
-
2389
- ## License
2390
-
2391
- [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)