@tencentcloud/sdk-mcp 0.1.0 → 1.0.0

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 (309) hide show
  1. package/@tencent/aegis-node-sdk/CHANGELOG.md +8 -0
  2. package/@tencent/aegis-node-sdk/LICENSE +21 -0
  3. package/@tencent/aegis-node-sdk/README.md +562 -0
  4. package/@tencent/aegis-node-sdk/lib/aegis.min.js +1 -0
  5. package/@tencent/aegis-node-sdk/lib/packages/core/src/constant/config.d.ts +14 -0
  6. package/@tencent/aegis-node-sdk/lib/packages/core/src/constant/global.d.ts +1 -0
  7. package/@tencent/aegis-node-sdk/lib/packages/core/src/constant/index.d.ts +9 -0
  8. package/@tencent/aegis-node-sdk/lib/packages/core/src/constant/report-ignore.d.ts +2 -0
  9. package/@tencent/aegis-node-sdk/lib/packages/core/src/core.d.ts +85 -0
  10. package/@tencent/aegis-node-sdk/lib/packages/core/src/hooks/afterRequestHooks.d.ts +3 -0
  11. package/@tencent/aegis-node-sdk/lib/packages/core/src/hooks/beforeRequestHooks.d.ts +9 -0
  12. package/@tencent/aegis-node-sdk/lib/packages/core/src/hooks/modifyRequestHooks.d.ts +3 -0
  13. package/@tencent/aegis-node-sdk/lib/packages/core/src/index.d.ts +9 -0
  14. package/@tencent/aegis-node-sdk/lib/packages/core/src/interface/config.d.ts +62 -0
  15. package/@tencent/aegis-node-sdk/lib/packages/core/src/interface/env.d.ts +11 -0
  16. package/@tencent/aegis-node-sdk/lib/packages/core/src/interface/index.d.ts +4 -0
  17. package/@tencent/aegis-node-sdk/lib/packages/core/src/interface/log.d.ts +130 -0
  18. package/@tencent/aegis-node-sdk/lib/packages/core/src/interface/send.d.ts +34 -0
  19. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/format.d.ts +2 -0
  20. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/index.d.ts +18 -0
  21. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/length-limit.d.ts +8 -0
  22. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/pv.d.ts +8 -0
  23. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/remove-payload.d.ts +2 -0
  24. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/repeat-limit.d.ts +4 -0
  25. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/report.d.ts +10 -0
  26. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/sample.d.ts +3 -0
  27. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/throttle.d.ts +3 -0
  28. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/trace/index.d.ts +34 -0
  29. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/trace/jwt.d.ts +12 -0
  30. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/trace/ot-js.d.ts +14 -0
  31. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/trace/uuid.d.ts +2 -0
  32. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/whitelist.d.ts +12 -0
  33. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/write-before.d.ts +3 -0
  34. package/@tencent/aegis-node-sdk/lib/packages/core/src/plugin.d.ts +33 -0
  35. package/@tencent/aegis-node-sdk/lib/packages/core/src/polyfill.d.ts +0 -0
  36. package/@tencent/aegis-node-sdk/lib/packages/core/src/util/destroy.d.ts +2 -0
  37. package/@tencent/aegis-node-sdk/lib/packages/core/src/util/event-emitter.d.ts +18 -0
  38. package/@tencent/aegis-node-sdk/lib/packages/core/src/util/index.d.ts +60 -0
  39. package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/index.d.ts +15 -0
  40. package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/interface/selector.d.ts +5 -0
  41. package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/pipes/batch-report-pipe.d.ts +6 -0
  42. package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/protocol/protocol_base.d.ts +18 -0
  43. package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/protocol/protocol_http.d.ts +12 -0
  44. package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/selector/ip_selector.d.ts +10 -0
  45. package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/selector/polaris_selector.d.ts +20 -0
  46. package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/selector/selector_base.d.ts +27 -0
  47. package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/util/eval_require.d.ts +2 -0
  48. package/@tencent/aegis-node-sdk/package.json +19 -0
  49. package/@tencent/polaris/README.md +407 -0
  50. package/@tencent/polaris/dist/consumer/health.d.ts +126 -0
  51. package/@tencent/polaris/dist/consumer/health.js +283 -0
  52. package/@tencent/polaris/dist/consumer/health.js.map +1 -0
  53. package/@tencent/polaris/dist/consumer/index.d.ts +120 -0
  54. package/@tencent/polaris/dist/consumer/index.js +348 -0
  55. package/@tencent/polaris/dist/consumer/index.js.map +1 -0
  56. package/@tencent/polaris/dist/consumer/monitor.d.ts +145 -0
  57. package/@tencent/polaris/dist/consumer/monitor.js +343 -0
  58. package/@tencent/polaris/dist/consumer/monitor.js.map +1 -0
  59. package/@tencent/polaris/dist/consumer/selector.d.ts +73 -0
  60. package/@tencent/polaris/dist/consumer/selector.js +316 -0
  61. package/@tencent/polaris/dist/consumer/selector.js.map +1 -0
  62. package/@tencent/polaris/dist/errors.d.ts +373 -0
  63. package/@tencent/polaris/dist/errors.js +154 -0
  64. package/@tencent/polaris/dist/errors.js.map +1 -0
  65. package/@tencent/polaris/dist/global.d.ts +16 -0
  66. package/@tencent/polaris/dist/global.js +18 -0
  67. package/@tencent/polaris/dist/global.js.map +1 -0
  68. package/@tencent/polaris/dist/index.d.ts +62 -0
  69. package/@tencent/polaris/dist/index.js +145 -0
  70. package/@tencent/polaris/dist/index.js.map +1 -0
  71. package/@tencent/polaris/dist/instance.d.ts +109 -0
  72. package/@tencent/polaris/dist/instance.js +38 -0
  73. package/@tencent/polaris/dist/instance.js.map +1 -0
  74. package/@tencent/polaris/dist/limiter/bucket.d.ts +51 -0
  75. package/@tencent/polaris/dist/limiter/bucket.js +152 -0
  76. package/@tencent/polaris/dist/limiter/bucket.js.map +1 -0
  77. package/@tencent/polaris/dist/limiter/index.d.ts +73 -0
  78. package/@tencent/polaris/dist/limiter/index.js +149 -0
  79. package/@tencent/polaris/dist/limiter/index.js.map +1 -0
  80. package/@tencent/polaris/dist/limiter/ratelimit.d.ts +27 -0
  81. package/@tencent/polaris/dist/limiter/ratelimit.js +134 -0
  82. package/@tencent/polaris/dist/limiter/ratelimit.js.map +1 -0
  83. package/@tencent/polaris/dist/limiter/ratelimiter/base.d.ts +17 -0
  84. package/@tencent/polaris/dist/limiter/ratelimiter/base.js +15 -0
  85. package/@tencent/polaris/dist/limiter/ratelimiter/base.js.map +1 -0
  86. package/@tencent/polaris/dist/limiter/ratelimiter/global.d.ts +59 -0
  87. package/@tencent/polaris/dist/limiter/ratelimiter/global.js +397 -0
  88. package/@tencent/polaris/dist/limiter/ratelimiter/global.js.map +1 -0
  89. package/@tencent/polaris/dist/limiter/ratelimiter/index.d.ts +3 -0
  90. package/@tencent/polaris/dist/limiter/ratelimiter/index.js +19 -0
  91. package/@tencent/polaris/dist/limiter/ratelimiter/index.js.map +1 -0
  92. package/@tencent/polaris/dist/limiter/ratelimiter/local.d.ts +17 -0
  93. package/@tencent/polaris/dist/limiter/ratelimiter/local.js +52 -0
  94. package/@tencent/polaris/dist/limiter/ratelimiter/local.js.map +1 -0
  95. package/@tencent/polaris/dist/location.d.ts +48 -0
  96. package/@tencent/polaris/dist/location.js +67 -0
  97. package/@tencent/polaris/dist/location.js.map +1 -0
  98. package/@tencent/polaris/dist/logging.d.ts +106 -0
  99. package/@tencent/polaris/dist/logging.js +130 -0
  100. package/@tencent/polaris/dist/logging.js.map +1 -0
  101. package/@tencent/polaris/dist/metadata.d.ts +78 -0
  102. package/@tencent/polaris/dist/metadata.js +119 -0
  103. package/@tencent/polaris/dist/metadata.js.map +1 -0
  104. package/@tencent/polaris/dist/plugins/breaker/polaris.d.ts +47 -0
  105. package/@tencent/polaris/dist/plugins/breaker/polaris.js +162 -0
  106. package/@tencent/polaris/dist/plugins/breaker/polaris.js.map +1 -0
  107. package/@tencent/polaris/dist/plugins/lb/base.d.ts +24 -0
  108. package/@tencent/polaris/dist/plugins/lb/base.js +32 -0
  109. package/@tencent/polaris/dist/plugins/lb/base.js.map +1 -0
  110. package/@tencent/polaris/dist/plugins/lb/edf.d.ts +24 -0
  111. package/@tencent/polaris/dist/plugins/lb/edf.js +77 -0
  112. package/@tencent/polaris/dist/plugins/lb/edf.js.map +1 -0
  113. package/@tencent/polaris/dist/plugins/lb/hashring.d.ts +24 -0
  114. package/@tencent/polaris/dist/plugins/lb/hashring.js +53 -0
  115. package/@tencent/polaris/dist/plugins/lb/hashring.js.map +1 -0
  116. package/@tencent/polaris/dist/plugins/lb/sticky.d.ts +31 -0
  117. package/@tencent/polaris/dist/plugins/lb/sticky.js +88 -0
  118. package/@tencent/polaris/dist/plugins/lb/sticky.js.map +1 -0
  119. package/@tencent/polaris/dist/plugins/lb/swrr.d.ts +25 -0
  120. package/@tencent/polaris/dist/plugins/lb/swrr.js +72 -0
  121. package/@tencent/polaris/dist/plugins/lb/swrr.js.map +1 -0
  122. package/@tencent/polaris/dist/plugins/lb/wr.d.ts +17 -0
  123. package/@tencent/polaris/dist/plugins/lb/wr.js +50 -0
  124. package/@tencent/polaris/dist/plugins/lb/wr.js.map +1 -0
  125. package/@tencent/polaris/dist/plugins/lb/wrr.d.ts +19 -0
  126. package/@tencent/polaris/dist/plugins/lb/wrr.js +81 -0
  127. package/@tencent/polaris/dist/plugins/lb/wrr.js.map +1 -0
  128. package/@tencent/polaris/dist/plugins/logging/console.d.ts +10 -0
  129. package/@tencent/polaris/dist/plugins/logging/console.js +38 -0
  130. package/@tencent/polaris/dist/plugins/logging/console.js.map +1 -0
  131. package/@tencent/polaris/dist/plugins/naming/local-server/index.d.ts +32 -0
  132. package/@tencent/polaris/dist/plugins/naming/local-server/index.js +88 -0
  133. package/@tencent/polaris/dist/plugins/naming/local-server/index.js.map +1 -0
  134. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/base.d.ts +124 -0
  135. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/base.js +398 -0
  136. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/base.js.map +1 -0
  137. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/discover.d.ts +27 -0
  138. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/discover.js +287 -0
  139. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/discover.js.map +1 -0
  140. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/index.d.ts +15 -0
  141. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/index.js +43 -0
  142. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/index.js.map +1 -0
  143. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/monitor.d.ts +28 -0
  144. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/monitor.js +249 -0
  145. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/monitor.js.map +1 -0
  146. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/ratelimit.d.ts +19 -0
  147. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/ratelimit.js +222 -0
  148. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/ratelimit.js.map +1 -0
  149. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/bidi.d.ts +26 -0
  150. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/bidi.js +99 -0
  151. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/bidi.js.map +1 -0
  152. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/index.d.ts +60 -0
  153. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/index.js +259 -0
  154. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/index.js.map +1 -0
  155. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/pb/discover.proto +24 -0
  156. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/pb/monitor.proto +18 -0
  157. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/pb/ratelimit.proto +12 -0
  158. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/http/index.d.ts +39 -0
  159. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/http/index.js +115 -0
  160. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/http/index.js.map +1 -0
  161. package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/api.proto +24 -0
  162. package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/client.proto +22 -0
  163. package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/model.proto +28 -0
  164. package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/ratelimit.proto +80 -0
  165. package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/request.proto +18 -0
  166. package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/response.proto +65 -0
  167. package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/routing.proto +66 -0
  168. package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/service.proto +95 -0
  169. package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/types.d.ts +1568 -0
  170. package/@tencent/polaris/dist/plugins/naming/polaris-server/index.d.ts +36 -0
  171. package/@tencent/polaris/dist/plugins/naming/polaris-server/index.js +51 -0
  172. package/@tencent/polaris/dist/plugins/naming/polaris-server/index.js.map +1 -0
  173. package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/api.proto +18 -0
  174. package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/circuitbreak.proto +67 -0
  175. package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/request.proto +82 -0
  176. package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/response.proto +11 -0
  177. package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/sdkcache.proto +46 -0
  178. package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/sdkconfiguration.proto +16 -0
  179. package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/sdktoken.proto +10 -0
  180. package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/types.d.ts +1102 -0
  181. package/@tencent/polaris/dist/plugins/naming/polaris-server/pool.d.ts +29 -0
  182. package/@tencent/polaris/dist/plugins/naming/polaris-server/pool.js +77 -0
  183. package/@tencent/polaris/dist/plugins/naming/polaris-server/pool.js.map +1 -0
  184. package/@tencent/polaris/dist/plugins/naming/polaris-server/ratelimit-pb/api.proto +12 -0
  185. package/@tencent/polaris/dist/plugins/naming/polaris-server/ratelimit-pb/ratelimit.proto +28 -0
  186. package/@tencent/polaris/dist/plugins/naming/polaris-server/ratelimit-pb/types.d.ts +395 -0
  187. package/@tencent/polaris/dist/plugins/naming/polaris-server/rules.d.ts +13 -0
  188. package/@tencent/polaris/dist/plugins/naming/polaris-server/rules.js +116 -0
  189. package/@tencent/polaris/dist/plugins/naming/polaris-server/rules.js.map +1 -0
  190. package/@tencent/polaris/dist/plugins/naming/polaris-server/types.d.ts +67 -0
  191. package/@tencent/polaris/dist/plugins/naming/polaris-server/types.js +67 -0
  192. package/@tencent/polaris/dist/plugins/naming/polaris-server/types.js.map +1 -0
  193. package/@tencent/polaris/dist/plugins/naming/polaris-server/utils.d.ts +99 -0
  194. package/@tencent/polaris/dist/plugins/naming/polaris-server/utils.js +217 -0
  195. package/@tencent/polaris/dist/plugins/naming/polaris-server/utils.js.map +1 -0
  196. package/@tencent/polaris/dist/plugins/registry/memory.d.ts +10 -0
  197. package/@tencent/polaris/dist/plugins/registry/memory.js +50 -0
  198. package/@tencent/polaris/dist/plugins/registry/memory.js.map +1 -0
  199. package/@tencent/polaris/dist/plugins/router/polaris/nearby.d.ts +51 -0
  200. package/@tencent/polaris/dist/plugins/router/polaris/nearby.js +145 -0
  201. package/@tencent/polaris/dist/plugins/router/polaris/nearby.js.map +1 -0
  202. package/@tencent/polaris/dist/plugins/router/polaris/rule.d.ts +11 -0
  203. package/@tencent/polaris/dist/plugins/router/polaris/rule.js +174 -0
  204. package/@tencent/polaris/dist/plugins/router/polaris/rule.js.map +1 -0
  205. package/@tencent/polaris/dist/plugins/router/trpc/canary.d.ts +25 -0
  206. package/@tencent/polaris/dist/plugins/router/trpc/canary.js +36 -0
  207. package/@tencent/polaris/dist/plugins/router/trpc/canary.js.map +1 -0
  208. package/@tencent/polaris/dist/plugins/router/trpc/env.d.ts +10 -0
  209. package/@tencent/polaris/dist/plugins/router/trpc/env.js +34 -0
  210. package/@tencent/polaris/dist/plugins/router/trpc/env.js.map +1 -0
  211. package/@tencent/polaris/dist/plugins/router/trpc/set.d.ts +56 -0
  212. package/@tencent/polaris/dist/plugins/router/trpc/set.js +106 -0
  213. package/@tencent/polaris/dist/plugins/router/trpc/set.js.map +1 -0
  214. package/@tencent/polaris/dist/plugins/shaping/unirate.d.ts +31 -0
  215. package/@tencent/polaris/dist/plugins/shaping/unirate.js +124 -0
  216. package/@tencent/polaris/dist/plugins/shaping/unirate.js.map +1 -0
  217. package/@tencent/polaris/dist/plugins/shaping/warmup.d.ts +61 -0
  218. package/@tencent/polaris/dist/plugins/shaping/warmup.js +171 -0
  219. package/@tencent/polaris/dist/plugins/shaping/warmup.js.map +1 -0
  220. package/@tencent/polaris/dist/plugins/weight/polaris.d.ts +23 -0
  221. package/@tencent/polaris/dist/plugins/weight/polaris.js +159 -0
  222. package/@tencent/polaris/dist/plugins/weight/polaris.js.map +1 -0
  223. package/@tencent/polaris/dist/plugins.d.ts +619 -0
  224. package/@tencent/polaris/dist/plugins.js +91 -0
  225. package/@tencent/polaris/dist/plugins.js.map +1 -0
  226. package/@tencent/polaris/dist/polaris.d.ts +33 -0
  227. package/@tencent/polaris/dist/polaris.js +59 -0
  228. package/@tencent/polaris/dist/polaris.js.map +1 -0
  229. package/@tencent/polaris/dist/provider/index.d.ts +102 -0
  230. package/@tencent/polaris/dist/provider/index.js +168 -0
  231. package/@tencent/polaris/dist/provider/index.js.map +1 -0
  232. package/@tencent/polaris/dist/registry.d.ts +174 -0
  233. package/@tencent/polaris/dist/registry.js +660 -0
  234. package/@tencent/polaris/dist/registry.js.map +1 -0
  235. package/@tencent/polaris/dist/rules.d.ts +163 -0
  236. package/@tencent/polaris/dist/rules.js +24 -0
  237. package/@tencent/polaris/dist/rules.js.map +1 -0
  238. package/@tencent/polaris/dist/scripts/postinstall.d.ts +1 -0
  239. package/@tencent/polaris/dist/scripts/postinstall.js +71 -0
  240. package/@tencent/polaris/dist/scripts/postinstall.js.map +1 -0
  241. package/@tencent/polaris/dist/service.d.ts +18 -0
  242. package/@tencent/polaris/dist/service.js +3 -0
  243. package/@tencent/polaris/dist/service.js.map +1 -0
  244. package/@tencent/polaris/dist/skeleton.d.ts +87 -0
  245. package/@tencent/polaris/dist/skeleton.js +282 -0
  246. package/@tencent/polaris/dist/skeleton.js.map +1 -0
  247. package/@tencent/polaris/dist/utils.d.ts +36 -0
  248. package/@tencent/polaris/dist/utils.js +74 -0
  249. package/@tencent/polaris/dist/utils.js.map +1 -0
  250. package/@tencent/polaris/dist/weak.d.ts +11 -0
  251. package/@tencent/polaris/dist/weak.js +44 -0
  252. package/@tencent/polaris/dist/weak.js.map +1 -0
  253. package/@tencent/polaris/node_modules/axios/CHANGELOG.md +891 -0
  254. package/@tencent/polaris/node_modules/axios/LICENSE +19 -0
  255. package/@tencent/polaris/node_modules/axios/README.md +908 -0
  256. package/@tencent/polaris/node_modules/axios/SECURITY.md +5 -0
  257. package/@tencent/polaris/node_modules/axios/UPGRADE_GUIDE.md +168 -0
  258. package/@tencent/polaris/node_modules/axios/dist/axios.js +2277 -0
  259. package/@tencent/polaris/node_modules/axios/dist/axios.map +1 -0
  260. package/@tencent/polaris/node_modules/axios/dist/axios.min.js +4 -0
  261. package/@tencent/polaris/node_modules/axios/dist/axios.min.map +1 -0
  262. package/@tencent/polaris/node_modules/axios/index.d.ts +221 -0
  263. package/@tencent/polaris/node_modules/axios/index.js +1 -0
  264. package/@tencent/polaris/node_modules/axios/lib/adapters/README.md +37 -0
  265. package/@tencent/polaris/node_modules/axios/lib/adapters/http.js +388 -0
  266. package/@tencent/polaris/node_modules/axios/lib/adapters/xhr.js +212 -0
  267. package/@tencent/polaris/node_modules/axios/lib/axios.js +57 -0
  268. package/@tencent/polaris/node_modules/axios/lib/cancel/Cancel.js +19 -0
  269. package/@tencent/polaris/node_modules/axios/lib/cancel/CancelToken.js +119 -0
  270. package/@tencent/polaris/node_modules/axios/lib/cancel/isCancel.js +5 -0
  271. package/@tencent/polaris/node_modules/axios/lib/core/Axios.js +155 -0
  272. package/@tencent/polaris/node_modules/axios/lib/core/InterceptorManager.js +54 -0
  273. package/@tencent/polaris/node_modules/axios/lib/core/README.md +8 -0
  274. package/@tencent/polaris/node_modules/axios/lib/core/buildFullPath.js +20 -0
  275. package/@tencent/polaris/node_modules/axios/lib/core/createError.js +18 -0
  276. package/@tencent/polaris/node_modules/axios/lib/core/dispatchRequest.js +87 -0
  277. package/@tencent/polaris/node_modules/axios/lib/core/enhanceError.js +43 -0
  278. package/@tencent/polaris/node_modules/axios/lib/core/mergeConfig.js +99 -0
  279. package/@tencent/polaris/node_modules/axios/lib/core/settle.js +25 -0
  280. package/@tencent/polaris/node_modules/axios/lib/core/transformData.js +22 -0
  281. package/@tencent/polaris/node_modules/axios/lib/defaults.js +134 -0
  282. package/@tencent/polaris/node_modules/axios/lib/env/README.md +3 -0
  283. package/@tencent/polaris/node_modules/axios/lib/env/data.js +3 -0
  284. package/@tencent/polaris/node_modules/axios/lib/helpers/README.md +7 -0
  285. package/@tencent/polaris/node_modules/axios/lib/helpers/bind.js +11 -0
  286. package/@tencent/polaris/node_modules/axios/lib/helpers/buildURL.js +70 -0
  287. package/@tencent/polaris/node_modules/axios/lib/helpers/combineURLs.js +14 -0
  288. package/@tencent/polaris/node_modules/axios/lib/helpers/cookies.js +53 -0
  289. package/@tencent/polaris/node_modules/axios/lib/helpers/deprecatedMethod.js +24 -0
  290. package/@tencent/polaris/node_modules/axios/lib/helpers/isAbsoluteURL.js +14 -0
  291. package/@tencent/polaris/node_modules/axios/lib/helpers/isAxiosError.js +13 -0
  292. package/@tencent/polaris/node_modules/axios/lib/helpers/isURLSameOrigin.js +68 -0
  293. package/@tencent/polaris/node_modules/axios/lib/helpers/normalizeHeaderName.js +12 -0
  294. package/@tencent/polaris/node_modules/axios/lib/helpers/parseHeaders.js +53 -0
  295. package/@tencent/polaris/node_modules/axios/lib/helpers/spread.js +27 -0
  296. package/@tencent/polaris/node_modules/axios/lib/helpers/toFormData.js +55 -0
  297. package/@tencent/polaris/node_modules/axios/lib/helpers/validator.js +82 -0
  298. package/@tencent/polaris/node_modules/axios/lib/utils.js +349 -0
  299. package/@tencent/polaris/node_modules/axios/package.json +86 -0
  300. package/@tencent/polaris/node_modules/axios/tsconfig.json +14 -0
  301. package/@tencent/polaris/node_modules/axios/tslint.json +6 -0
  302. package/@tencent/polaris/package.json +114 -0
  303. package/README.md +42 -0
  304. package/cursor-setting.png +0 -0
  305. package/mcp-server-prompt.png +0 -0
  306. package/mcp.json +9 -0
  307. package/package.json +1 -1
  308. package/server.js +8 -0
  309. package/server.js.map +1 -1
@@ -0,0 +1,908 @@
1
+ # axios
2
+
3
+ [![npm version](https://img.shields.io/npm/v/axios.svg?style=flat-square)](https://www.npmjs.org/package/axios)
4
+ [![CDNJS](https://img.shields.io/cdnjs/v/axios.svg?style=flat-square)](https://cdnjs.com/libraries/axios)
5
+ ![Build status](https://github.com/axios/axios/actions/workflows/ci.yml/badge.svg)
6
+ [![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/axios/axios)
7
+ [![code coverage](https://img.shields.io/coveralls/mzabriskie/axios.svg?style=flat-square)](https://coveralls.io/r/mzabriskie/axios)
8
+ [![install size](https://packagephobia.now.sh/badge?p=axios)](https://packagephobia.now.sh/result?p=axios)
9
+ [![npm downloads](https://img.shields.io/npm/dm/axios.svg?style=flat-square)](http://npm-stat.com/charts.html?package=axios)
10
+ [![gitter chat](https://img.shields.io/gitter/room/mzabriskie/axios.svg?style=flat-square)](https://gitter.im/mzabriskie/axios)
11
+ [![code helpers](https://www.codetriage.com/axios/axios/badges/users.svg)](https://www.codetriage.com/axios/axios)
12
+
13
+ Promise based HTTP client for the browser and node.js
14
+
15
+ > New axios docs website: [click here](https://axios-http.com/)
16
+
17
+ ## Table of Contents
18
+
19
+ - [Features](#features)
20
+ - [Browser Support](#browser-support)
21
+ - [Installing](#installing)
22
+ - [Example](#example)
23
+ - [Axios API](#axios-api)
24
+ - [Request method aliases](#request-method-aliases)
25
+ - [Concurrency (Deprecated)](#concurrency-deprecated)
26
+ - [Creating an instance](#creating-an-instance)
27
+ - [Instance methods](#instance-methods)
28
+ - [Request Config](#request-config)
29
+ - [Response Schema](#response-schema)
30
+ - [Config Defaults](#config-defaults)
31
+ - [Global axios defaults](#global-axios-defaults)
32
+ - [Custom instance defaults](#custom-instance-defaults)
33
+ - [Config order of precedence](#config-order-of-precedence)
34
+ - [Interceptors](#interceptors)
35
+ - [Multiple Interceptors](#multiple-interceptors)
36
+ - [Handling Errors](#handling-errors)
37
+ - [Cancellation](#cancellation)
38
+ - [Using application/x-www-form-urlencoded format](#using-applicationx-www-form-urlencoded-format)
39
+ - [Browser](#browser)
40
+ - [Node.js](#nodejs)
41
+ - [Query string](#query-string)
42
+ - [Form data](#form-data)
43
+ - [Semver](#semver)
44
+ - [Promises](#promises)
45
+ - [TypeScript](#typescript)
46
+ - [Resources](#resources)
47
+ - [Credits](#credits)
48
+ - [License](#license)
49
+
50
+ ## Features
51
+
52
+ - Make [XMLHttpRequests](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) from the browser
53
+ - Make [http](http://nodejs.org/api/http.html) requests from node.js
54
+ - Supports the [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) API
55
+ - Intercept request and response
56
+ - Transform request and response data
57
+ - Cancel requests
58
+ - Automatic transforms for JSON data
59
+ - Client side support for protecting against [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery)
60
+
61
+ ## Browser Support
62
+
63
+ ![Chrome](https://raw.github.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png) | ![Firefox](https://raw.github.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png) | ![Safari](https://raw.github.com/alrra/browser-logos/master/src/safari/safari_48x48.png) | ![Opera](https://raw.github.com/alrra/browser-logos/master/src/opera/opera_48x48.png) | ![Edge](https://raw.github.com/alrra/browser-logos/master/src/edge/edge_48x48.png) | ![IE](https://raw.github.com/alrra/browser-logos/master/src/archive/internet-explorer_9-11/internet-explorer_9-11_48x48.png) |
64
+ --- | --- | --- | --- | --- | --- |
65
+ Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11 ✔ |
66
+
67
+ [![Browser Matrix](https://saucelabs.com/open_sauce/build_matrix/axios.svg)](https://saucelabs.com/u/axios)
68
+
69
+ ## Installing
70
+
71
+ Using npm:
72
+
73
+ ```bash
74
+ $ npm install axios
75
+ ```
76
+
77
+ Using bower:
78
+
79
+ ```bash
80
+ $ bower install axios
81
+ ```
82
+
83
+ Using yarn:
84
+
85
+ ```bash
86
+ $ yarn add axios
87
+ ```
88
+
89
+ Using jsDelivr CDN:
90
+
91
+ ```html
92
+ <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
93
+ ```
94
+
95
+ Using unpkg CDN:
96
+
97
+ ```html
98
+ <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
99
+ ```
100
+
101
+ ## Example
102
+
103
+ ### note: CommonJS usage
104
+ In order to gain the TypeScript typings (for intellisense / autocomplete) while using CommonJS imports with `require()` use the following approach:
105
+
106
+ ```js
107
+ const axios = require('axios').default;
108
+
109
+ // axios.<method> will now provide autocomplete and parameter typings
110
+ ```
111
+
112
+ Performing a `GET` request
113
+
114
+ ```js
115
+ const axios = require('axios');
116
+
117
+ // Make a request for a user with a given ID
118
+ axios.get('/user?ID=12345')
119
+ .then(function (response) {
120
+ // handle success
121
+ console.log(response);
122
+ })
123
+ .catch(function (error) {
124
+ // handle error
125
+ console.log(error);
126
+ })
127
+ .then(function () {
128
+ // always executed
129
+ });
130
+
131
+ // Optionally the request above could also be done as
132
+ axios.get('/user', {
133
+ params: {
134
+ ID: 12345
135
+ }
136
+ })
137
+ .then(function (response) {
138
+ console.log(response);
139
+ })
140
+ .catch(function (error) {
141
+ console.log(error);
142
+ })
143
+ .then(function () {
144
+ // always executed
145
+ });
146
+
147
+ // Want to use async/await? Add the `async` keyword to your outer function/method.
148
+ async function getUser() {
149
+ try {
150
+ const response = await axios.get('/user?ID=12345');
151
+ console.log(response);
152
+ } catch (error) {
153
+ console.error(error);
154
+ }
155
+ }
156
+ ```
157
+
158
+ > **NOTE:** `async/await` is part of ECMAScript 2017 and is not supported in Internet
159
+ > Explorer and older browsers, so use with caution.
160
+
161
+ Performing a `POST` request
162
+
163
+ ```js
164
+ axios.post('/user', {
165
+ firstName: 'Fred',
166
+ lastName: 'Flintstone'
167
+ })
168
+ .then(function (response) {
169
+ console.log(response);
170
+ })
171
+ .catch(function (error) {
172
+ console.log(error);
173
+ });
174
+ ```
175
+
176
+ Performing multiple concurrent requests
177
+
178
+ ```js
179
+ function getUserAccount() {
180
+ return axios.get('/user/12345');
181
+ }
182
+
183
+ function getUserPermissions() {
184
+ return axios.get('/user/12345/permissions');
185
+ }
186
+
187
+ Promise.all([getUserAccount(), getUserPermissions()])
188
+ .then(function (results) {
189
+ const acct = results[0];
190
+ const perm = results[1];
191
+ });
192
+ ```
193
+
194
+ ## axios API
195
+
196
+ Requests can be made by passing the relevant config to `axios`.
197
+
198
+ ##### axios(config)
199
+
200
+ ```js
201
+ // Send a POST request
202
+ axios({
203
+ method: 'post',
204
+ url: '/user/12345',
205
+ data: {
206
+ firstName: 'Fred',
207
+ lastName: 'Flintstone'
208
+ }
209
+ });
210
+ ```
211
+
212
+ ```js
213
+ // GET request for remote image in node.js
214
+ axios({
215
+ method: 'get',
216
+ url: 'http://bit.ly/2mTM3nY',
217
+ responseType: 'stream'
218
+ })
219
+ .then(function (response) {
220
+ response.data.pipe(fs.createWriteStream('ada_lovelace.jpg'))
221
+ });
222
+ ```
223
+
224
+ ##### axios(url[, config])
225
+
226
+ ```js
227
+ // Send a GET request (default method)
228
+ axios('/user/12345');
229
+ ```
230
+
231
+ ### Request method aliases
232
+
233
+ For convenience aliases have been provided for all supported request methods.
234
+
235
+ ##### axios.request(config)
236
+ ##### axios.get(url[, config])
237
+ ##### axios.delete(url[, config])
238
+ ##### axios.head(url[, config])
239
+ ##### axios.options(url[, config])
240
+ ##### axios.post(url[, data[, config]])
241
+ ##### axios.put(url[, data[, config]])
242
+ ##### axios.patch(url[, data[, config]])
243
+
244
+ ###### NOTE
245
+ When using the alias methods `url`, `method`, and `data` properties don't need to be specified in config.
246
+
247
+ ### Concurrency (Deprecated)
248
+ Please use `Promise.all` to replace the below functions.
249
+
250
+ Helper functions for dealing with concurrent requests.
251
+
252
+ axios.all(iterable)
253
+ axios.spread(callback)
254
+
255
+ ### Creating an instance
256
+
257
+ You can create a new instance of axios with a custom config.
258
+
259
+ ##### axios.create([config])
260
+
261
+ ```js
262
+ const instance = axios.create({
263
+ baseURL: 'https://some-domain.com/api/',
264
+ timeout: 1000,
265
+ headers: {'X-Custom-Header': 'foobar'}
266
+ });
267
+ ```
268
+
269
+ ### Instance methods
270
+
271
+ The available instance methods are listed below. The specified config will be merged with the instance config.
272
+
273
+ ##### axios#request(config)
274
+ ##### axios#get(url[, config])
275
+ ##### axios#delete(url[, config])
276
+ ##### axios#head(url[, config])
277
+ ##### axios#options(url[, config])
278
+ ##### axios#post(url[, data[, config]])
279
+ ##### axios#put(url[, data[, config]])
280
+ ##### axios#patch(url[, data[, config]])
281
+ ##### axios#getUri([config])
282
+
283
+ ## Request Config
284
+
285
+ These are the available config options for making requests. Only the `url` is required. Requests will default to `GET` if `method` is not specified.
286
+
287
+ ```js
288
+ {
289
+ // `url` is the server URL that will be used for the request
290
+ url: '/user',
291
+
292
+ // `method` is the request method to be used when making the request
293
+ method: 'get', // default
294
+
295
+ // `baseURL` will be prepended to `url` unless `url` is absolute.
296
+ // It can be convenient to set `baseURL` for an instance of axios to pass relative URLs
297
+ // to methods of that instance.
298
+ baseURL: 'https://some-domain.com/api/',
299
+
300
+ // `transformRequest` allows changes to the request data before it is sent to the server
301
+ // This is only applicable for request methods 'PUT', 'POST', 'PATCH' and 'DELETE'
302
+ // The last function in the array must return a string or an instance of Buffer, ArrayBuffer,
303
+ // FormData or Stream
304
+ // You may modify the headers object.
305
+ transformRequest: [function (data, headers) {
306
+ // Do whatever you want to transform the data
307
+
308
+ return data;
309
+ }],
310
+
311
+ // `transformResponse` allows changes to the response data to be made before
312
+ // it is passed to then/catch
313
+ transformResponse: [function (data) {
314
+ // Do whatever you want to transform the data
315
+
316
+ return data;
317
+ }],
318
+
319
+ // `headers` are custom headers to be sent
320
+ headers: {'X-Requested-With': 'XMLHttpRequest'},
321
+
322
+ // `params` are the URL parameters to be sent with the request
323
+ // Must be a plain object or a URLSearchParams object
324
+ params: {
325
+ ID: 12345
326
+ },
327
+
328
+ // `paramsSerializer` is an optional function in charge of serializing `params`
329
+ // (e.g. https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/)
330
+ paramsSerializer: function (params) {
331
+ return Qs.stringify(params, {arrayFormat: 'brackets'})
332
+ },
333
+
334
+ // `data` is the data to be sent as the request body
335
+ // Only applicable for request methods 'PUT', 'POST', 'DELETE , and 'PATCH'
336
+ // When no `transformRequest` is set, must be of one of the following types:
337
+ // - string, plain object, ArrayBuffer, ArrayBufferView, URLSearchParams
338
+ // - Browser only: FormData, File, Blob
339
+ // - Node only: Stream, Buffer
340
+ data: {
341
+ firstName: 'Fred'
342
+ },
343
+
344
+ // syntax alternative to send data into the body
345
+ // method post
346
+ // only the value is sent, not the key
347
+ data: 'Country=Brasil&City=Belo Horizonte',
348
+
349
+ // `timeout` specifies the number of milliseconds before the request times out.
350
+ // If the request takes longer than `timeout`, the request will be aborted.
351
+ timeout: 1000, // default is `0` (no timeout)
352
+
353
+ // `withCredentials` indicates whether or not cross-site Access-Control requests
354
+ // should be made using credentials
355
+ withCredentials: false, // default
356
+
357
+ // `adapter` allows custom handling of requests which makes testing easier.
358
+ // Return a promise and supply a valid response (see lib/adapters/README.md).
359
+ adapter: function (config) {
360
+ /* ... */
361
+ },
362
+
363
+ // `auth` indicates that HTTP Basic auth should be used, and supplies credentials.
364
+ // This will set an `Authorization` header, overwriting any existing
365
+ // `Authorization` custom headers you have set using `headers`.
366
+ // Please note that only HTTP Basic auth is configurable through this parameter.
367
+ // For Bearer tokens and such, use `Authorization` custom headers instead.
368
+ auth: {
369
+ username: 'janedoe',
370
+ password: 's00pers3cret'
371
+ },
372
+
373
+ // `responseType` indicates the type of data that the server will respond with
374
+ // options are: 'arraybuffer', 'document', 'json', 'text', 'stream'
375
+ // browser only: 'blob'
376
+ responseType: 'json', // default
377
+
378
+ // `responseEncoding` indicates encoding to use for decoding responses (Node.js only)
379
+ // Note: Ignored for `responseType` of 'stream' or client-side requests
380
+ responseEncoding: 'utf8', // default
381
+
382
+ // `xsrfCookieName` is the name of the cookie to use as a value for xsrf token
383
+ xsrfCookieName: 'XSRF-TOKEN', // default
384
+
385
+ // `xsrfHeaderName` is the name of the http header that carries the xsrf token value
386
+ xsrfHeaderName: 'X-XSRF-TOKEN', // default
387
+
388
+ // `onUploadProgress` allows handling of progress events for uploads
389
+ // browser only
390
+ onUploadProgress: function (progressEvent) {
391
+ // Do whatever you want with the native progress event
392
+ },
393
+
394
+ // `onDownloadProgress` allows handling of progress events for downloads
395
+ // browser only
396
+ onDownloadProgress: function (progressEvent) {
397
+ // Do whatever you want with the native progress event
398
+ },
399
+
400
+ // `maxContentLength` defines the max size of the http response content in bytes allowed in node.js
401
+ maxContentLength: 2000,
402
+
403
+ // `maxBodyLength` (Node only option) defines the max size of the http request content in bytes allowed
404
+ maxBodyLength: 2000,
405
+
406
+ // `validateStatus` defines whether to resolve or reject the promise for a given
407
+ // HTTP response status code. If `validateStatus` returns `true` (or is set to `null`
408
+ // or `undefined`), the promise will be resolved; otherwise, the promise will be
409
+ // rejected.
410
+ validateStatus: function (status) {
411
+ return status >= 200 && status < 300; // default
412
+ },
413
+
414
+ // `maxRedirects` defines the maximum number of redirects to follow in node.js.
415
+ // If set to 0, no redirects will be followed.
416
+ maxRedirects: 5, // default
417
+
418
+ // `socketPath` defines a UNIX Socket to be used in node.js.
419
+ // e.g. '/var/run/docker.sock' to send requests to the docker daemon.
420
+ // Only either `socketPath` or `proxy` can be specified.
421
+ // If both are specified, `socketPath` is used.
422
+ socketPath: null, // default
423
+
424
+ // `httpAgent` and `httpsAgent` define a custom agent to be used when performing http
425
+ // and https requests, respectively, in node.js. This allows options to be added like
426
+ // `keepAlive` that are not enabled by default.
427
+ httpAgent: new http.Agent({ keepAlive: true }),
428
+ httpsAgent: new https.Agent({ keepAlive: true }),
429
+
430
+ // `proxy` defines the hostname, port, and protocol of the proxy server.
431
+ // You can also define your proxy using the conventional `http_proxy` and
432
+ // `https_proxy` environment variables. If you are using environment variables
433
+ // for your proxy configuration, you can also define a `no_proxy` environment
434
+ // variable as a comma-separated list of domains that should not be proxied.
435
+ // Use `false` to disable proxies, ignoring environment variables.
436
+ // `auth` indicates that HTTP Basic auth should be used to connect to the proxy, and
437
+ // supplies credentials.
438
+ // This will set an `Proxy-Authorization` header, overwriting any existing
439
+ // `Proxy-Authorization` custom headers you have set using `headers`.
440
+ // If the proxy server uses HTTPS, then you must set the protocol to `https`.
441
+ proxy: {
442
+ protocol: 'https',
443
+ host: '127.0.0.1',
444
+ port: 9000,
445
+ auth: {
446
+ username: 'mikeymike',
447
+ password: 'rapunz3l'
448
+ }
449
+ },
450
+
451
+ // `cancelToken` specifies a cancel token that can be used to cancel the request
452
+ // (see Cancellation section below for details)
453
+ cancelToken: new CancelToken(function (cancel) {
454
+ }),
455
+
456
+ // an alternative way to cancel Axios requests using AbortController
457
+ signal: new AbortController().signal,
458
+
459
+ // `decompress` indicates whether or not the response body should be decompressed
460
+ // automatically. If set to `true` will also remove the 'content-encoding' header
461
+ // from the responses objects of all decompressed responses
462
+ // - Node only (XHR cannot turn off decompression)
463
+ decompress: true // default
464
+
465
+ // `insecureHTTPParser` boolean.
466
+ // Indicates where to use an insecure HTTP parser that accepts invalid HTTP headers.
467
+ // This may allow interoperability with non-conformant HTTP implementations.
468
+ // Using the insecure parser should be avoided.
469
+ // see options https://nodejs.org/dist/latest-v12.x/docs/api/http.html#http_http_request_url_options_callback
470
+ // see also https://nodejs.org/en/blog/vulnerability/february-2020-security-releases/#strict-http-header-parsing-none
471
+ insecureHTTPParser: undefined // default
472
+
473
+ // transitional options for backward compatibility that may be removed in the newer versions
474
+ transitional: {
475
+ // silent JSON parsing mode
476
+ // `true` - ignore JSON parsing errors and set response.data to null if parsing failed (old behaviour)
477
+ // `false` - throw SyntaxError if JSON parsing failed (Note: responseType must be set to 'json')
478
+ silentJSONParsing: true, // default value for the current Axios version
479
+
480
+ // try to parse the response string as JSON even if `responseType` is not 'json'
481
+ forcedJSONParsing: true,
482
+
483
+ // throw ETIMEDOUT error instead of generic ECONNABORTED on request timeouts
484
+ clarifyTimeoutError: false,
485
+ }
486
+ }
487
+ ```
488
+
489
+ ## Response Schema
490
+
491
+ The response for a request contains the following information.
492
+
493
+ ```js
494
+ {
495
+ // `data` is the response that was provided by the server
496
+ data: {},
497
+
498
+ // `status` is the HTTP status code from the server response
499
+ status: 200,
500
+
501
+ // `statusText` is the HTTP status message from the server response
502
+ statusText: 'OK',
503
+
504
+ // `headers` the HTTP headers that the server responded with
505
+ // All header names are lower cased and can be accessed using the bracket notation.
506
+ // Example: `response.headers['content-type']`
507
+ headers: {},
508
+
509
+ // `config` is the config that was provided to `axios` for the request
510
+ config: {},
511
+
512
+ // `request` is the request that generated this response
513
+ // It is the last ClientRequest instance in node.js (in redirects)
514
+ // and an XMLHttpRequest instance in the browser
515
+ request: {}
516
+ }
517
+ ```
518
+
519
+ When using `then`, you will receive the response as follows:
520
+
521
+ ```js
522
+ axios.get('/user/12345')
523
+ .then(function (response) {
524
+ console.log(response.data);
525
+ console.log(response.status);
526
+ console.log(response.statusText);
527
+ console.log(response.headers);
528
+ console.log(response.config);
529
+ });
530
+ ```
531
+
532
+ 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.
533
+
534
+ ## Config Defaults
535
+
536
+ You can specify config defaults that will be applied to every request.
537
+
538
+ ### Global axios defaults
539
+
540
+ ```js
541
+ axios.defaults.baseURL = 'https://api.example.com';
542
+
543
+ // Important: If axios is used with multiple domains, the AUTH_TOKEN will be sent to all of them.
544
+ // See below for an example using Custom instance defaults instead.
545
+ axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
546
+
547
+ axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
548
+ ```
549
+
550
+ ### Custom instance defaults
551
+
552
+ ```js
553
+ // Set config defaults when creating the instance
554
+ const instance = axios.create({
555
+ baseURL: 'https://api.example.com'
556
+ });
557
+
558
+ // Alter defaults after instance has been created
559
+ instance.defaults.headers.common['Authorization'] = AUTH_TOKEN;
560
+ ```
561
+
562
+ ### Config order of precedence
563
+
564
+ Config will be merged with an order of precedence. The order is library defaults found in [lib/defaults.js](https://github.com/axios/axios/blob/master/lib/defaults.js#L28), 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.
565
+
566
+ ```js
567
+ // Create an instance using the config defaults provided by the library
568
+ // At this point the timeout config value is `0` as is the default for the library
569
+ const instance = axios.create();
570
+
571
+ // Override timeout default for the library
572
+ // Now all requests using this instance will wait 2.5 seconds before timing out
573
+ instance.defaults.timeout = 2500;
574
+
575
+ // Override timeout for this request as it's known to take a long time
576
+ instance.get('/longRequest', {
577
+ timeout: 5000
578
+ });
579
+ ```
580
+
581
+ ## Interceptors
582
+
583
+ You can intercept requests or responses before they are handled by `then` or `catch`.
584
+
585
+ ```js
586
+ // Add a request interceptor
587
+ axios.interceptors.request.use(function (config) {
588
+ // Do something before request is sent
589
+ return config;
590
+ }, function (error) {
591
+ // Do something with request error
592
+ return Promise.reject(error);
593
+ });
594
+
595
+ // Add a response interceptor
596
+ axios.interceptors.response.use(function (response) {
597
+ // Any status code that lie within the range of 2xx cause this function to trigger
598
+ // Do something with response data
599
+ return response;
600
+ }, function (error) {
601
+ // Any status codes that falls outside the range of 2xx cause this function to trigger
602
+ // Do something with response error
603
+ return Promise.reject(error);
604
+ });
605
+ ```
606
+
607
+ If you need to remove an interceptor later you can.
608
+
609
+ ```js
610
+ const myInterceptor = axios.interceptors.request.use(function () {/*...*/});
611
+ axios.interceptors.request.eject(myInterceptor);
612
+ ```
613
+
614
+ You can add interceptors to a custom instance of axios.
615
+
616
+ ```js
617
+ const instance = axios.create();
618
+ instance.interceptors.request.use(function () {/*...*/});
619
+ ```
620
+
621
+ When you add request interceptors, they are presumed to be asynchronous by default. This can cause a delay
622
+ in the execution of your axios request when the main thread is blocked (a promise is created under the hood for
623
+ the interceptor and your request gets put on the bottom of the call stack). If your request interceptors are synchronous you can add a flag
624
+ to the options object that will tell axios to run the code synchronously and avoid any delays in request execution.
625
+
626
+ ```js
627
+ axios.interceptors.request.use(function (config) {
628
+ config.headers.test = 'I am only a header!';
629
+ return config;
630
+ }, null, { synchronous: true });
631
+ ```
632
+
633
+ If you want to execute a particular interceptor based on a runtime check,
634
+ you can add a `runWhen` function to the options object. The interceptor will not be executed **if and only if** the return
635
+ of `runWhen` is `false`. The function will be called with the config
636
+ object (don't forget that you can bind your own arguments to it as well.) This can be handy when you have an
637
+ asynchronous request interceptor that only needs to run at certain times.
638
+
639
+ ```js
640
+ function onGetCall(config) {
641
+ return config.method === 'get';
642
+ }
643
+ axios.interceptors.request.use(function (config) {
644
+ config.headers.test = 'special get headers';
645
+ return config;
646
+ }, null, { runWhen: onGetCall });
647
+ ```
648
+
649
+ ### Multiple Interceptors
650
+
651
+ Given you add multiple response interceptors
652
+ and when the response was fulfilled
653
+ - then each interceptor is executed
654
+ - then they are executed in the order they were added
655
+ - then only the last interceptor's result is returned
656
+ - then every interceptor receives the result of it's predecessor
657
+ - and when the fulfillment-interceptor throws
658
+ - then the following fulfillment-interceptor is not called
659
+ - then the following rejection-interceptor is called
660
+ - once caught, another following fulfill-interceptor is called again (just like in a promise chain).
661
+
662
+ Read [the interceptor tests](./test/specs/interceptors.spec.js) for seeing all this in code.
663
+
664
+ ## Handling Errors
665
+
666
+ ```js
667
+ axios.get('/user/12345')
668
+ .catch(function (error) {
669
+ if (error.response) {
670
+ // The request was made and the server responded with a status code
671
+ // that falls out of the range of 2xx
672
+ console.log(error.response.data);
673
+ console.log(error.response.status);
674
+ console.log(error.response.headers);
675
+ } else if (error.request) {
676
+ // The request was made but no response was received
677
+ // `error.request` is an instance of XMLHttpRequest in the browser and an instance of
678
+ // http.ClientRequest in node.js
679
+ console.log(error.request);
680
+ } else {
681
+ // Something happened in setting up the request that triggered an Error
682
+ console.log('Error', error.message);
683
+ }
684
+ console.log(error.config);
685
+ });
686
+ ```
687
+
688
+ Using the `validateStatus` config option, you can define HTTP code(s) that should throw an error.
689
+
690
+ ```js
691
+ axios.get('/user/12345', {
692
+ validateStatus: function (status) {
693
+ return status < 500; // Resolve only if the status code is less than 500
694
+ }
695
+ })
696
+ ```
697
+
698
+ Using `toJSON` you get an object with more information about the HTTP error.
699
+
700
+ ```js
701
+ axios.get('/user/12345')
702
+ .catch(function (error) {
703
+ console.log(error.toJSON());
704
+ });
705
+ ```
706
+
707
+ ## Cancellation
708
+
709
+ You can cancel a request using a *cancel token*.
710
+
711
+ > The axios cancel token API is based on the withdrawn [cancelable promises proposal](https://github.com/tc39/proposal-cancelable-promises).
712
+
713
+ You can create a cancel token using the `CancelToken.source` factory as shown below:
714
+
715
+ ```js
716
+ const CancelToken = axios.CancelToken;
717
+ const source = CancelToken.source();
718
+
719
+ axios.get('/user/12345', {
720
+ cancelToken: source.token
721
+ }).catch(function (thrown) {
722
+ if (axios.isCancel(thrown)) {
723
+ console.log('Request canceled', thrown.message);
724
+ } else {
725
+ // handle error
726
+ }
727
+ });
728
+
729
+ axios.post('/user/12345', {
730
+ name: 'new name'
731
+ }, {
732
+ cancelToken: source.token
733
+ })
734
+
735
+ // cancel the request (the message parameter is optional)
736
+ source.cancel('Operation canceled by the user.');
737
+ ```
738
+
739
+ You can also create a cancel token by passing an executor function to the `CancelToken` constructor:
740
+
741
+ ```js
742
+ const CancelToken = axios.CancelToken;
743
+ let cancel;
744
+
745
+ axios.get('/user/12345', {
746
+ cancelToken: new CancelToken(function executor(c) {
747
+ // An executor function receives a cancel function as a parameter
748
+ cancel = c;
749
+ })
750
+ });
751
+
752
+ // cancel the request
753
+ cancel();
754
+ ```
755
+
756
+ Axios supports AbortController to abort requests in [`fetch API`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API#aborting_a_fetch) way:
757
+ ```js
758
+ const controller = new AbortController();
759
+
760
+ axios.get('/foo/bar', {
761
+ signal: controller.signal
762
+ }).then(function(response) {
763
+ //...
764
+ });
765
+ // cancel the request
766
+ controller.abort()
767
+ ```
768
+
769
+ > Note: you can cancel several requests with the same cancel token/abort controller.
770
+ > 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 real request.
771
+
772
+ ## Using application/x-www-form-urlencoded format
773
+
774
+ By default, axios serializes JavaScript objects to `JSON`. To send data in the `application/x-www-form-urlencoded` format instead, you can use one of the following options.
775
+
776
+ ### Browser
777
+
778
+ In a browser, you can use the [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams) API as follows:
779
+
780
+ ```js
781
+ const params = new URLSearchParams();
782
+ params.append('param1', 'value1');
783
+ params.append('param2', 'value2');
784
+ axios.post('/foo', params);
785
+ ```
786
+
787
+ > Note that `URLSearchParams` is not supported by all browsers (see [caniuse.com](http://www.caniuse.com/#feat=urlsearchparams)), but there is a [polyfill](https://github.com/WebReflection/url-search-params) available (make sure to polyfill the global environment).
788
+
789
+ Alternatively, you can encode data using the [`qs`](https://github.com/ljharb/qs) library:
790
+
791
+ ```js
792
+ const qs = require('qs');
793
+ axios.post('/foo', qs.stringify({ 'bar': 123 }));
794
+ ```
795
+
796
+ Or in another way (ES6),
797
+
798
+ ```js
799
+ import qs from 'qs';
800
+ const data = { 'bar': 123 };
801
+ const options = {
802
+ method: 'POST',
803
+ headers: { 'content-type': 'application/x-www-form-urlencoded' },
804
+ data: qs.stringify(data),
805
+ url,
806
+ };
807
+ axios(options);
808
+ ```
809
+
810
+ ### Node.js
811
+
812
+ #### Query string
813
+
814
+ In node.js, you can use the [`querystring`](https://nodejs.org/api/querystring.html) module as follows:
815
+
816
+ ```js
817
+ const querystring = require('querystring');
818
+ axios.post('http://something.com/', querystring.stringify({ foo: 'bar' }));
819
+ ```
820
+
821
+ or ['URLSearchParams'](https://nodejs.org/api/url.html#url_class_urlsearchparams) from ['url module'](https://nodejs.org/api/url.html) as follows:
822
+
823
+ ```js
824
+ const url = require('url');
825
+ const params = new url.URLSearchParams({ foo: 'bar' });
826
+ axios.post('http://something.com/', params.toString());
827
+ ```
828
+
829
+ You can also use the [`qs`](https://github.com/ljharb/qs) library.
830
+
831
+ ###### NOTE
832
+ The `qs` library is preferable if you need to stringify nested objects, as the `querystring` method has known issues with that use case (https://github.com/nodejs/node-v0.x-archive/issues/1665).
833
+
834
+ #### Form data
835
+
836
+ In node.js, you can use the [`form-data`](https://github.com/form-data/form-data) library as follows:
837
+
838
+ ```js
839
+ const FormData = require('form-data');
840
+
841
+ const form = new FormData();
842
+ form.append('my_field', 'my value');
843
+ form.append('my_buffer', new Buffer(10));
844
+ form.append('my_file', fs.createReadStream('/foo/bar.jpg'));
845
+
846
+ axios.post('https://example.com', form, { headers: form.getHeaders() })
847
+ ```
848
+
849
+ Alternatively, use an interceptor:
850
+
851
+ ```js
852
+ axios.interceptors.request.use(config => {
853
+ if (config.data instanceof FormData) {
854
+ Object.assign(config.headers, config.data.getHeaders());
855
+ }
856
+ return config;
857
+ });
858
+ ```
859
+
860
+ ## Semver
861
+
862
+ Until axios reaches a `1.0` release, breaking changes will be released with a new minor version. For example `0.5.1`, and `0.5.4` will have the same API, but `0.6.0` will have breaking changes.
863
+
864
+ ## Promises
865
+
866
+ axios depends on a native ES6 Promise implementation to be [supported](http://caniuse.com/promises).
867
+ If your environment doesn't support ES6 Promises, you can [polyfill](https://github.com/jakearchibald/es6-promise).
868
+
869
+ ## TypeScript
870
+
871
+ axios includes [TypeScript](http://typescriptlang.org) definitions and a type guard for axios errors.
872
+
873
+ ```typescript
874
+ let user: User = null;
875
+ try {
876
+ const { data } = await axios.get('/user?ID=12345');
877
+ user = data.userDetails;
878
+ } catch (error) {
879
+ if (axios.isAxiosError(error)) {
880
+ handleAxiosError(error);
881
+ } else {
882
+ handleUnexpectedError(error);
883
+ }
884
+ }
885
+ ```
886
+
887
+ ## Online one-click setup
888
+
889
+ You can use Gitpod an online IDE(which is free for Open Source) for contributing or running the examples online.
890
+
891
+ [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/axios/axios/blob/master/examples/server.js)
892
+
893
+
894
+ ## Resources
895
+
896
+ * [Changelog](https://github.com/axios/axios/blob/master/CHANGELOG.md)
897
+ * [Upgrade Guide](https://github.com/axios/axios/blob/master/UPGRADE_GUIDE.md)
898
+ * [Ecosystem](https://github.com/axios/axios/blob/master/ECOSYSTEM.md)
899
+ * [Contributing Guide](https://github.com/axios/axios/blob/master/CONTRIBUTING.md)
900
+ * [Code of Conduct](https://github.com/axios/axios/blob/master/CODE_OF_CONDUCT.md)
901
+
902
+ ## Credits
903
+
904
+ 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.
905
+
906
+ ## License
907
+
908
+ [MIT](LICENSE)