🔧 npm update
This commit is contained in:
326
node_modules/axios/CHANGELOG.md
generated
vendored
326
node_modules/axios/CHANGELOG.md
generated
vendored
@@ -1,5 +1,331 @@
|
||||
# Changelog
|
||||
|
||||
## [1.8.4](https://github.com/axios/axios/compare/v1.8.3...v1.8.4) (2025-03-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **buildFullPath:** handle `allowAbsoluteUrls: false` without `baseURL` ([#6833](https://github.com/axios/axios/issues/6833)) ([f10c2e0](https://github.com/axios/axios/commit/f10c2e0de7fde0051f848609a29c2906d0caa1d9))
|
||||
|
||||
### Contributors to this release
|
||||
|
||||
- <img src="https://avatars.githubusercontent.com/u/8029107?v=4&s=18" alt="avatar" width="18"/> [Marc Hassan](https://github.com/mhassan1 "+5/-1 (#6833 )")
|
||||
|
||||
## [1.8.3](https://github.com/axios/axios/compare/v1.8.2...v1.8.3) (2025-03-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add missing type for allowAbsoluteUrls ([#6818](https://github.com/axios/axios/issues/6818)) ([10fa70e](https://github.com/axios/axios/commit/10fa70ef14fe39558b15a179f0e82f5f5e5d11b2))
|
||||
* **xhr/fetch:** pass `allowAbsoluteUrls` to `buildFullPath` in `xhr` and `fetch` adapters ([#6814](https://github.com/axios/axios/issues/6814)) ([ec159e5](https://github.com/axios/axios/commit/ec159e507bdf08c04ba1a10fe7710094e9e50ec9))
|
||||
|
||||
### Contributors to this release
|
||||
|
||||
- <img src="https://avatars.githubusercontent.com/u/3238291?v=4&s=18" alt="avatar" width="18"/> [Ashcon Partovi](https://github.com/Electroid "+6/-0 (#6811 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/28559054?v=4&s=18" alt="avatar" width="18"/> [StefanBRas](https://github.com/StefanBRas "+4/-0 (#6818 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/8029107?v=4&s=18" alt="avatar" width="18"/> [Marc Hassan](https://github.com/mhassan1 "+2/-2 (#6814 )")
|
||||
|
||||
## [1.8.2](https://github.com/axios/axios/compare/v1.8.1...v1.8.2) (2025-03-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **http-adapter:** add allowAbsoluteUrls to path building ([#6810](https://github.com/axios/axios/issues/6810)) ([fb8eec2](https://github.com/axios/axios/commit/fb8eec214ce7744b5ca787f2c3b8339b2f54b00f))
|
||||
|
||||
### Contributors to this release
|
||||
|
||||
- <img src="https://avatars.githubusercontent.com/u/14166260?v=4&s=18" alt="avatar" width="18"/> [Fasoro-Joseph Alexander](https://github.com/lexcorp16 "+1/-1 (#6810 )")
|
||||
|
||||
## [1.8.1](https://github.com/axios/axios/compare/v1.8.0...v1.8.1) (2025-02-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **utils:** move `generateString` to platform utils to avoid importing crypto module into client builds; ([#6789](https://github.com/axios/axios/issues/6789)) ([36a5a62](https://github.com/axios/axios/commit/36a5a620bec0b181451927f13ac85b9888b86cec))
|
||||
|
||||
### Contributors to this release
|
||||
|
||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+51/-47 (#6789 )")
|
||||
|
||||
# [1.8.0](https://github.com/axios/axios/compare/v1.7.9...v1.8.0) (2025-02-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **examples:** application crashed when navigating examples in browser ([#5938](https://github.com/axios/axios/issues/5938)) ([1260ded](https://github.com/axios/axios/commit/1260ded634ec101dd5ed05d3b70f8e8f899dba6c))
|
||||
* missing word in SUPPORT_QUESTION.yml ([#6757](https://github.com/axios/axios/issues/6757)) ([1f890b1](https://github.com/axios/axios/commit/1f890b13f2c25a016f3c84ae78efb769f244133e))
|
||||
* **utils:** replace getRandomValues with crypto module ([#6788](https://github.com/axios/axios/issues/6788)) ([23a25af](https://github.com/axios/axios/commit/23a25af0688d1db2c396deb09229d2271cc24f6c))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Add config for ignoring absolute URLs ([#5902](https://github.com/axios/axios/issues/5902)) ([#6192](https://github.com/axios/axios/issues/6192)) ([32c7bcc](https://github.com/axios/axios/commit/32c7bcc0f233285ba27dec73a4b1e81fb7a219b3))
|
||||
|
||||
|
||||
### Reverts
|
||||
|
||||
* Revert "chore: expose fromDataToStream to be consumable (#6731)" (#6732) ([1317261](https://github.com/axios/axios/commit/1317261125e9c419fe9f126867f64d28f9c1efda)), closes [#6731](https://github.com/axios/axios/issues/6731) [#6732](https://github.com/axios/axios/issues/6732)
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* code relying on the above will now combine the URLs instead of prefer request URL
|
||||
|
||||
* feat: add config option for allowing absolute URLs
|
||||
|
||||
* fix: add default value for allowAbsoluteUrls in buildFullPath
|
||||
|
||||
* fix: typo in flow control when setting allowAbsoluteUrls
|
||||
|
||||
### Contributors to this release
|
||||
|
||||
- <img src="https://avatars.githubusercontent.com/u/7661715?v=4&s=18" alt="avatar" width="18"/> [Michael Toscano](https://github.com/GethosTheWalrus "+42/-8 (#6192 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/22686401?v=4&s=18" alt="avatar" width="18"/> [Willian Agostini](https://github.com/WillianAgostini "+26/-3 (#6788 #6777 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/72578270?v=4&s=18" alt="avatar" width="18"/> [Naron](https://github.com/naronchen "+27/-0 (#5901 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/47430686?v=4&s=18" alt="avatar" width="18"/> [shravan || श्रvan](https://github.com/shravan20 "+7/-3 (#6116 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/145078271?v=4&s=18" alt="avatar" width="18"/> [Justin Dhillon](https://github.com/justindhillon "+0/-7 (#6312 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/30925732?v=4&s=18" alt="avatar" width="18"/> [yionr](https://github.com/yionr "+5/-1 (#6129 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/534166?v=4&s=18" alt="avatar" width="18"/> [Shin'ya Ueoka](https://github.com/ueokande "+3/-3 (#5935 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/33569?v=4&s=18" alt="avatar" width="18"/> [Dan Dascalescu](https://github.com/dandv "+3/-3 (#5908 #6757 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/16476523?v=4&s=18" alt="avatar" width="18"/> [Nitin Ramnani](https://github.com/NitinRamnani "+2/-2 (#5938 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/152275799?v=4&s=18" alt="avatar" width="18"/> [Shay Molcho](https://github.com/shaymolcho "+2/-2 (#6770 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/4814473?v=4&s=18" alt="avatar" width="18"/> [Jay](https://github.com/jasonsaayman "+0/-3 (#6732 )")
|
||||
- fancy45daddy
|
||||
- <img src="https://avatars.githubusercontent.com/u/127725897?v=4&s=18" alt="avatar" width="18"/> [Habip Akyol](https://github.com/habipakyol "+1/-1 (#6030 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/54869395?v=4&s=18" alt="avatar" width="18"/> [Bailey Lissington](https://github.com/llamington "+1/-1 (#6771 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/14969290?v=4&s=18" alt="avatar" width="18"/> [Bernardo da Eira Duarte](https://github.com/bernardoduarte "+1/-1 (#6480 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/117800149?v=4&s=18" alt="avatar" width="18"/> [Shivam Batham](https://github.com/Shivam-Batham "+1/-1 (#5949 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/67861627?v=4&s=18" alt="avatar" width="18"/> [Lipin Kariappa](https://github.com/lipinnnnn "+1/-1 (#5936 )")
|
||||
|
||||
## [1.7.9](https://github.com/axios/axios/compare/v1.7.8...v1.7.9) (2024-12-04)
|
||||
|
||||
|
||||
### Reverts
|
||||
|
||||
* Revert "fix(types): export CJS types from ESM (#6218)" (#6729) ([c44d2f2](https://github.com/axios/axios/commit/c44d2f2316ad289b38997657248ba10de11deb6c)), closes [#6218](https://github.com/axios/axios/issues/6218) [#6729](https://github.com/axios/axios/issues/6729)
|
||||
|
||||
### Contributors to this release
|
||||
|
||||
- <img src="https://avatars.githubusercontent.com/u/4814473?v=4&s=18" alt="avatar" width="18"/> [Jay](https://github.com/jasonsaayman "+596/-108 (#6729 )")
|
||||
|
||||
## [1.7.8](https://github.com/axios/axios/compare/v1.7.7...v1.7.8) (2024-11-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* allow passing a callback as paramsSerializer to buildURL ([#6680](https://github.com/axios/axios/issues/6680)) ([eac4619](https://github.com/axios/axios/commit/eac4619fe2e0926e876cd260ee21e3690381dbb5))
|
||||
* **core:** fixed config merging bug ([#6668](https://github.com/axios/axios/issues/6668)) ([5d99fe4](https://github.com/axios/axios/commit/5d99fe4491202a6268c71e5dcc09192359d73cea))
|
||||
* fixed width form to not shrink after 'Send Request' button is clicked ([#6644](https://github.com/axios/axios/issues/6644)) ([7ccd5fd](https://github.com/axios/axios/commit/7ccd5fd42402102d38712c32707bf055be72ab54))
|
||||
* **http:** add support for File objects as payload in http adapter ([#6588](https://github.com/axios/axios/issues/6588)) ([#6605](https://github.com/axios/axios/issues/6605)) ([6841d8d](https://github.com/axios/axios/commit/6841d8d18ddc71cc1bd202ffcfddb3f95622eef3))
|
||||
* **http:** fixed proxy-from-env module import ([#5222](https://github.com/axios/axios/issues/5222)) ([12b3295](https://github.com/axios/axios/commit/12b32957f1258aee94ef859809ed39f8f88f9dfa))
|
||||
* **http:** use `globalThis.TextEncoder` when available ([#6634](https://github.com/axios/axios/issues/6634)) ([df956d1](https://github.com/axios/axios/commit/df956d18febc9100a563298dfdf0f102c3d15410))
|
||||
* ios11 breaks when build ([#6608](https://github.com/axios/axios/issues/6608)) ([7638952](https://github.com/axios/axios/commit/763895270f7b50c7c780c3c9807ae8635de952cd))
|
||||
* **types:** add missing types for mergeConfig function ([#6590](https://github.com/axios/axios/issues/6590)) ([00de614](https://github.com/axios/axios/commit/00de614cd07b7149af335e202aef0e076c254f49))
|
||||
* **types:** export CJS types from ESM ([#6218](https://github.com/axios/axios/issues/6218)) ([c71811b](https://github.com/axios/axios/commit/c71811b00f2fcff558e4382ba913bdac4ad7200e))
|
||||
* updated stream aborted error message to be more clear ([#6615](https://github.com/axios/axios/issues/6615)) ([cc3217a](https://github.com/axios/axios/commit/cc3217a612024d83a663722a56d7a98d8759c6d5))
|
||||
* use URL API instead of DOM to fix a potential vulnerability warning; ([#6714](https://github.com/axios/axios/issues/6714)) ([0a8d6e1](https://github.com/axios/axios/commit/0a8d6e19da5b9899a2abafaaa06a75ee548597db))
|
||||
|
||||
### Contributors to this release
|
||||
|
||||
- <img src="https://avatars.githubusercontent.com/u/779047?v=4&s=18" alt="avatar" width="18"/> [Remco Haszing](https://github.com/remcohaszing "+108/-596 (#6218 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/4814473?v=4&s=18" alt="avatar" width="18"/> [Jay](https://github.com/jasonsaayman "+281/-19 (#6640 #6619 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/140250471?v=4&s=18" alt="avatar" width="18"/> [Aayush Yadav](https://github.com/aayushyadav020 "+124/-111 (#6617 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+12/-65 (#6714 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/479715?v=4&s=18" alt="avatar" width="18"/> [Ell Bradshaw](https://github.com/cincodenada "+29/-0 (#6489 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/60218780?v=4&s=18" alt="avatar" width="18"/> [Amit Saini](https://github.com/amitsainii "+13/-3 (#5237 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/19817867?v=4&s=18" alt="avatar" width="18"/> [Tommaso Paulon](https://github.com/guuido "+14/-1 (#6680 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/63336443?v=4&s=18" alt="avatar" width="18"/> [Akki](https://github.com/Aakash-Rana "+5/-5 (#6668 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/20028934?v=4&s=18" alt="avatar" width="18"/> [Sampo Silvennoinen](https://github.com/stscoundrel "+3/-3 (#6633 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/1174718?v=4&s=18" alt="avatar" width="18"/> [Kasper Isager Dalsgarð](https://github.com/kasperisager "+2/-2 (#6634 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/3709715?v=4&s=18" alt="avatar" width="18"/> [Christian Clauss](https://github.com/cclauss "+4/-0 (#6683 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/1639119?v=4&s=18" alt="avatar" width="18"/> [Pavan Welihinda](https://github.com/pavan168 "+2/-2 (#5222 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/5742900?v=4&s=18" alt="avatar" width="18"/> [Taylor Flatt](https://github.com/taylorflatt "+2/-2 (#6615 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/79452224?v=4&s=18" alt="avatar" width="18"/> [Kenzo Wada](https://github.com/Kenzo-Wada "+2/-2 (#6608 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/50064240?v=4&s=18" alt="avatar" width="18"/> [Ngole Lawson](https://github.com/echelonnought "+3/-0 (#6644 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/1262198?v=4&s=18" alt="avatar" width="18"/> [Haven](https://github.com/Baoyx007 "+3/-0 (#6590 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/149003676?v=4&s=18" alt="avatar" width="18"/> [Shrivali Dutt](https://github.com/shrivalidutt "+1/-1 (#6637 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/1304290?v=4&s=18" alt="avatar" width="18"/> [Henco Appel](https://github.com/hencoappel "+1/-1 (#6605 )")
|
||||
|
||||
## [1.7.7](https://github.com/axios/axios/compare/v1.7.6...v1.7.7) (2024-08-31)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **fetch:** fix stream handling in Safari by fallback to using a stream reader instead of an async iterator; ([#6584](https://github.com/axios/axios/issues/6584)) ([d198085](https://github.com/axios/axios/commit/d1980854fee1765cd02fa0787adf5d6e34dd9dcf))
|
||||
* **http:** fixed support for IPv6 literal strings in url ([#5731](https://github.com/axios/axios/issues/5731)) ([364993f](https://github.com/axios/axios/commit/364993f0d8bc6e0e06f76b8a35d2d0a35cab054c))
|
||||
|
||||
### Contributors to this release
|
||||
|
||||
- <img src="https://avatars.githubusercontent.com/u/10539109?v=4&s=18" alt="avatar" width="18"/> [Rishi556](https://github.com/Rishi556 "+39/-1 (#5731 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+27/-7 (#6584 )")
|
||||
|
||||
## [1.7.6](https://github.com/axios/axios/compare/v1.7.5...v1.7.6) (2024-08-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **fetch:** fix content length calculation for FormData payload; ([#6524](https://github.com/axios/axios/issues/6524)) ([085f568](https://github.com/axios/axios/commit/085f56861a83e9ac02c140ad9d68dac540dfeeaa))
|
||||
* **fetch:** optimize signals composing logic; ([#6582](https://github.com/axios/axios/issues/6582)) ([df9889b](https://github.com/axios/axios/commit/df9889b83c2cc37e9e6189675a73ab70c60f031f))
|
||||
|
||||
### Contributors to this release
|
||||
|
||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+98/-46 (#6582 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/3534453?v=4&s=18" alt="avatar" width="18"/> [Jacques Germishuys](https://github.com/jacquesg "+5/-1 (#6524 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/53894505?v=4&s=18" alt="avatar" width="18"/> [kuroino721](https://github.com/kuroino721 "+3/-1 (#6575 )")
|
||||
|
||||
## [1.7.5](https://github.com/axios/axios/compare/v1.7.4...v1.7.5) (2024-08-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **adapter:** fix undefined reference to hasBrowserEnv ([#6572](https://github.com/axios/axios/issues/6572)) ([7004707](https://github.com/axios/axios/commit/7004707c4180b416341863bd86913fe4fc2f1df1))
|
||||
* **core:** add the missed implementation of AxiosError#status property; ([#6573](https://github.com/axios/axios/issues/6573)) ([6700a8a](https://github.com/axios/axios/commit/6700a8adac06942205f6a7a21421ecb36c4e0852))
|
||||
* **core:** fix `ReferenceError: navigator is not defined` for custom environments; ([#6567](https://github.com/axios/axios/issues/6567)) ([fed1a4b](https://github.com/axios/axios/commit/fed1a4b2d78ed4a588c84e09d32749ed01dc2794))
|
||||
* **fetch:** fix credentials handling in Cloudflare workers ([#6533](https://github.com/axios/axios/issues/6533)) ([550d885](https://github.com/axios/axios/commit/550d885eb90fd156add7b93bbdc54d30d2f9a98d))
|
||||
|
||||
### Contributors to this release
|
||||
|
||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+187/-83 (#6573 #6567 #6566 #6564 #6563 #6557 #6556 #6555 #6554 #6552 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/2495809?v=4&s=18" alt="avatar" width="18"/> [Antonin Bas](https://github.com/antoninbas "+6/-6 (#6572 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/5406212?v=4&s=18" alt="avatar" width="18"/> [Hans Otto Wirtz](https://github.com/hansottowirtz "+4/-1 (#6533 )")
|
||||
|
||||
## [1.7.4](https://github.com/axios/axios/compare/v1.7.3...v1.7.4) (2024-08-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **sec:** CVE-2024-39338 ([#6539](https://github.com/axios/axios/issues/6539)) ([#6543](https://github.com/axios/axios/issues/6543)) ([6b6b605](https://github.com/axios/axios/commit/6b6b605eaf73852fb2dae033f1e786155959de3a))
|
||||
* **sec:** disregard protocol-relative URL to remediate SSRF ([#6539](https://github.com/axios/axios/issues/6539)) ([07a661a](https://github.com/axios/axios/commit/07a661a2a6b9092c4aa640dcc7f724ec5e65bdda))
|
||||
|
||||
### Contributors to this release
|
||||
|
||||
- <img src="https://avatars.githubusercontent.com/u/31389480?v=4&s=18" alt="avatar" width="18"/> [Lev Pachmanov](https://github.com/levpachmanov "+47/-11 (#6543 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/41283691?v=4&s=18" alt="avatar" width="18"/> [Đỗ Trọng Hải](https://github.com/hainenber "+49/-4 (#6539 )")
|
||||
|
||||
## [1.7.3](https://github.com/axios/axios/compare/v1.7.2...v1.7.3) (2024-08-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **adapter:** fix progress event emitting; ([#6518](https://github.com/axios/axios/issues/6518)) ([e3c76fc](https://github.com/axios/axios/commit/e3c76fc9bdd03aa4d98afaf211df943e2031453f))
|
||||
* **fetch:** fix withCredentials request config ([#6505](https://github.com/axios/axios/issues/6505)) ([85d4d0e](https://github.com/axios/axios/commit/85d4d0ea0aae91082f04e303dec46510d1b4e787))
|
||||
* **xhr:** return original config on errors from XHR adapter ([#6515](https://github.com/axios/axios/issues/6515)) ([8966ee7](https://github.com/axios/axios/commit/8966ee7ea62ecbd6cfb39a905939bcdab5cf6388))
|
||||
|
||||
### Contributors to this release
|
||||
|
||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+211/-159 (#6518 #6519 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/10867286?v=4&s=18" alt="avatar" width="18"/> [Valerii Sidorenko](https://github.com/ValeraS "+3/-3 (#6515 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/8599535?v=4&s=18" alt="avatar" width="18"/> [prianYu](https://github.com/prianyu "+2/-2 (#6505 )")
|
||||
|
||||
## [1.7.2](https://github.com/axios/axios/compare/v1.7.1...v1.7.2) (2024-05-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **fetch:** enhance fetch API detection; ([#6413](https://github.com/axios/axios/issues/6413)) ([4f79aef](https://github.com/axios/axios/commit/4f79aef81b7c4644328365bfc33acf0a9ef595bc))
|
||||
|
||||
### Contributors to this release
|
||||
|
||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+3/-3 (#6413 )")
|
||||
|
||||
## [1.7.1](https://github.com/axios/axios/compare/v1.7.0...v1.7.1) (2024-05-20)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **fetch:** fixed ReferenceError issue when TextEncoder is not available in the environment; ([#6410](https://github.com/axios/axios/issues/6410)) ([733f15f](https://github.com/axios/axios/commit/733f15fe5bd2d67e1fadaee82e7913b70d45dc5e))
|
||||
|
||||
### Contributors to this release
|
||||
|
||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+14/-9 (#6410 )")
|
||||
|
||||
# [1.7.0](https://github.com/axios/axios/compare/v1.7.0-beta.2...v1.7.0) (2024-05-19)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **adapter:** add fetch adapter; ([#6371](https://github.com/axios/axios/issues/6371)) ([a3ff99b](https://github.com/axios/axios/commit/a3ff99b59d8ec2ab5dd049e68c043617a4072e42))
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **core/axios:** handle un-writable error stack ([#6362](https://github.com/axios/axios/issues/6362)) ([81e0455](https://github.com/axios/axios/commit/81e0455b7b57fbaf2be16a73ebe0e6591cc6d8f9))
|
||||
|
||||
### Contributors to this release
|
||||
|
||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+1015/-127 (#6371 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/4814473?v=4&s=18" alt="avatar" width="18"/> [Jay](https://github.com/jasonsaayman "+30/-14 ()")
|
||||
- <img src="https://avatars.githubusercontent.com/u/16711696?v=4&s=18" alt="avatar" width="18"/> [Alexandre ABRIOUX](https://github.com/alexandre-abrioux "+56/-6 (#6362 )")
|
||||
|
||||
# [1.7.0-beta.2](https://github.com/axios/axios/compare/v1.7.0-beta.1...v1.7.0-beta.2) (2024-05-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **fetch:** capitalize HTTP method names; ([#6395](https://github.com/axios/axios/issues/6395)) ([ad3174a](https://github.com/axios/axios/commit/ad3174a3515c3c2573f4bcb94818d582826f3914))
|
||||
* **fetch:** fix & optimize progress capturing for cases when the request data has a nullish value or zero data length ([#6400](https://github.com/axios/axios/issues/6400)) ([95a3e8e](https://github.com/axios/axios/commit/95a3e8e346cfd6a5548e171f2341df3235d0e26b))
|
||||
* **fetch:** fix headers getting from a stream response; ([#6401](https://github.com/axios/axios/issues/6401)) ([870e0a7](https://github.com/axios/axios/commit/870e0a76f60d0094774a6a63fa606eec52a381af))
|
||||
|
||||
### Contributors to this release
|
||||
|
||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+99/-46 (#6405 #6404 #6401 #6400 #6395 )")
|
||||
|
||||
# [1.7.0-beta.1](https://github.com/axios/axios/compare/v1.7.0-beta.0...v1.7.0-beta.1) (2024-05-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **core/axios:** handle un-writable error stack ([#6362](https://github.com/axios/axios/issues/6362)) ([81e0455](https://github.com/axios/axios/commit/81e0455b7b57fbaf2be16a73ebe0e6591cc6d8f9))
|
||||
* **fetch:** fix cases when ReadableStream or Response.body are not available; ([#6377](https://github.com/axios/axios/issues/6377)) ([d1d359d](https://github.com/axios/axios/commit/d1d359da347704e8b28d768e61515a3e96c5b072))
|
||||
* **fetch:** treat fetch-related TypeError as an AxiosError.ERR_NETWORK error; ([#6380](https://github.com/axios/axios/issues/6380)) ([bb5f9a5](https://github.com/axios/axios/commit/bb5f9a5ab768452de9e166dc28d0ffc234245ef1))
|
||||
|
||||
### Contributors to this release
|
||||
|
||||
- <img src="https://avatars.githubusercontent.com/u/16711696?v=4&s=18" alt="avatar" width="18"/> [Alexandre ABRIOUX](https://github.com/alexandre-abrioux "+56/-6 (#6362 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+42/-17 (#6380 #6377 )")
|
||||
|
||||
# [1.7.0-beta.0](https://github.com/axios/axios/compare/v1.6.8...v1.7.0-beta.0) (2024-04-28)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **adapter:** add fetch adapter; ([#6371](https://github.com/axios/axios/issues/6371)) ([a3ff99b](https://github.com/axios/axios/commit/a3ff99b59d8ec2ab5dd049e68c043617a4072e42))
|
||||
|
||||
### Contributors to this release
|
||||
|
||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+1015/-127 (#6371 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/4814473?v=4&s=18" alt="avatar" width="18"/> [Jay](https://github.com/jasonsaayman "+30/-14 ()")
|
||||
|
||||
## [1.6.8](https://github.com/axios/axios/compare/v1.6.7...v1.6.8) (2024-03-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **AxiosHeaders:** fix AxiosHeaders conversion to an object during config merging ([#6243](https://github.com/axios/axios/issues/6243)) ([2656612](https://github.com/axios/axios/commit/2656612bc10fe2757e9832b708ed773ab340b5cb))
|
||||
* **import:** use named export for EventEmitter; ([7320430](https://github.com/axios/axios/commit/7320430aef2e1ba2b89488a0eaf42681165498b1))
|
||||
* **vulnerability:** update follow-redirects to 1.15.6 ([#6300](https://github.com/axios/axios/issues/6300)) ([8786e0f](https://github.com/axios/axios/commit/8786e0ff55a8c68d4ca989801ad26df924042e27))
|
||||
|
||||
### Contributors to this release
|
||||
|
||||
- <img src="https://avatars.githubusercontent.com/u/4814473?v=4&s=18" alt="avatar" width="18"/> [Jay](https://github.com/jasonsaayman "+4572/-3446 (#6238 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+30/-0 (#6231 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/68230846?v=4&s=18" alt="avatar" width="18"/> [Mitchell](https://github.com/Creaous "+9/-9 (#6300 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/53797821?v=4&s=18" alt="avatar" width="18"/> [Emmanuel](https://github.com/mannoeu "+2/-2 (#6196 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/44109284?v=4&s=18" alt="avatar" width="18"/> [Lucas Keller](https://github.com/ljkeller "+3/-0 (#6194 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/72791488?v=4&s=18" alt="avatar" width="18"/> [Aditya Mogili](https://github.com/ADITYA-176 "+1/-1 ()")
|
||||
- <img src="https://avatars.githubusercontent.com/u/46135319?v=4&s=18" alt="avatar" width="18"/> [Miroslav Petrov](https://github.com/petrovmiroslav "+1/-1 (#6243 )")
|
||||
|
||||
## [1.6.7](https://github.com/axios/axios/compare/v1.6.6...v1.6.7) (2024-01-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* capture async stack only for rejections with native error objects; ([#6203](https://github.com/axios/axios/issues/6203)) ([1a08f90](https://github.com/axios/axios/commit/1a08f90f402336e4d00e9ee82f211c6adb1640b0))
|
||||
|
||||
### Contributors to this release
|
||||
|
||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+30/-26 (#6203 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/73059627?v=4&s=18" alt="avatar" width="18"/> [zhoulixiang](https://github.com/zh-lx "+0/-3 (#6186 )")
|
||||
|
||||
## [1.6.6](https://github.com/axios/axios/compare/v1.6.5...v1.6.6) (2024-01-24)
|
||||
|
||||
|
||||
|
||||
146
node_modules/axios/README.md
generated
vendored
146
node_modules/axios/README.md
generated
vendored
@@ -1,46 +1,19 @@
|
||||
<h3 align="center">
|
||||
Platinum sponsors
|
||||
<br>
|
||||
</h3>
|
||||
|
||||
<div align="center">
|
||||
<a href="https://runalloy.com?utm_source=github&utm_medium=referral&utm_campaign=121423_axios">
|
||||
<picture>
|
||||
<source width="400px" media="(prefers-color-scheme: dark)" srcset="https://github.com/axios/axios/assets/4814473/f6067247-7eba-4069-852a-ab1bb85b1780">
|
||||
<source width="400px" media="(prefers-color-scheme: light)" srcset="https://github.com/axios/axios/assets/4814473/75c37f4d-36e6-44f5-a068-3edd77c00a10">
|
||||
<img width="400px" src="https://github.com/axios/axios/assets/4814473/75c37f4d-36e6-44f5-a068-3edd77c00a10" />
|
||||
</picture>
|
||||
</a>
|
||||
|
||||
<p align="center">Alloy is the integration development platform that makes it simple and <br>fast for SaaS companies to launch critical user-facing integrations.</p>
|
||||
<p align="center">
|
||||
<a href="https://runalloy.com/signup?utm_source=github&utm_medium=referral&utm_campaign=11823_axios"><b>Sign up free</b></a> •
|
||||
<a href="https://docs.runalloy.com/docs?utm_source=github&utm_medium=referral&utm_campaign=11823_axios"><b>Documentation</b></a>
|
||||
</p>
|
||||
<br><br>
|
||||
</div>
|
||||
|
||||
<h3 align="center">
|
||||
Gold sponsors
|
||||
<br><br>
|
||||
</h3>
|
||||
|
||||
<div align="center">
|
||||
<a href="https://stytch.com?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=logo&utm_campaign=axios-http">
|
||||
<picture>
|
||||
<source width="200px" media="(prefers-color-scheme: dark)" srcset="https://github.com/axios/axios/assets/4814473/538d715a-13c7-4668-ae7d-37a4548423f4">
|
||||
<source width="200px" media="(prefers-color-scheme: light)" srcset="https://github.com/axios/axios/assets/4814473/b6a9a7bc-9fb1-4b9b-909f-1b4bee1fd142">
|
||||
<img width="200px" src="https://github.com/axios/axios/assets/4814473/b6a9a7bc-9fb1-4b9b-909f-1b4bee1fd142" />
|
||||
</picture>
|
||||
</a>
|
||||
<p align="center">API-first authentication, authorization, and fraud prevention</p>
|
||||
<p align="center">
|
||||
<a href="https://stytch.com?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=website-link&utm_campaign=axios-http"><b>Website</b></a> •
|
||||
<a href="https://stytch.com/docs?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=docs-link&utm_campaign=axios-http"><b>Documentation</b></a> • <a href="https://github.com/stytchauth/stytch-node?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=node-sdk&utm_campaign=axios-http"><b>Node.js Backend SDK</b></a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<h3 align="center"> 🥇 Gold sponsors <br> </h3> <table align="center" width="100%"><tr width="33.333333333333336%"><td align="center" width="33.333333333333336%"> <a href="https://stytch.com/?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=website-link&utm_campaign=axios-http" style="padding: 10px; display: inline-block"> <picture> <source width="200px" height="38px" media="(prefers-color-scheme: dark)" srcset="https://axios-http.com/assets/sponsors/stytch_white.png"> <img width="200px" height="38px" src="https://axios-http.com/assets/sponsors/stytch.png" alt="Stytch"/> </picture> </a> <p align="center" title="API-first authentication, authorization, and fraud prevention">API-first authentication, authorization, and fraud prevention</p> <p align="center"> <a href="https://stytch.com/?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=website-link&utm_campaign=axios-http"><b>Website</b></a> | <a href="https://stytch.com/docs?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=docs-link&utm_campaign=axios-http"><b>Documentation</b></a> | <a href="https://github.com/stytchauth/stytch-node?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=node-sdk&utm_campaign=axios-http"><b>Node.js</b></a> </p>
|
||||
</td><td align="center" width="33.333333333333336%"> <a href="https://www.principal.com/about-us?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block"> <img width="133px" height="43px" src="https://axios-http.com/assets/sponsors/principal.svg" alt="Principal Financial Group"/> </a> <p align="center" title="We’re bound by one common purpose: to give you the financial tools, resources and information you need to live your best life.">We’re bound by one common purpose: to give you the financial tools, resources and information you ne...</p> <p align="center"> <a href="https://www.principal.com/about-us?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship"><b>www.principal.com</b></a> </p>
|
||||
</td><td align="center" width="33.333333333333336%"> <a href="https://www.descope.com/?utm_source=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship" style="padding: 10px; display: inline-block"> <picture> <source width="200px" height="52px" media="(prefers-color-scheme: dark)" srcset="https://axios-http.com/assets/sponsors/descope_white.png"> <img width="200px" height="52px" src="https://axios-http.com/assets/sponsors/descope.png" alt="Descope"/> </picture> </a> <p align="center" title="Hi, we're Descope! We are building something in the authentication space for app developers and can’t wait to place it in your hands.">Hi, we're Descope! We are building something in the authentication space for app developers and...</p> <p align="center"> <a href="https://www.descope.com/?utm_source=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship"><b>Website</b></a> | <a href="https://docs.descope.com/?utm_source=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship"><b>Documentation</b></a> | <a href="https://www.descope.com/community?utm_source=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship"><b>Community</b></a> </p>
|
||||
</td></tr><tr width="33.333333333333336%"><td align="center" width="33.333333333333336%"> <a href="https://buzzoid.com/buy-instagram-followers/?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block"> <img width="62px" height="70px" src="https://axios-http.com/assets/sponsors/opencollective/buzzoid-buy-instagram-followers.png" alt="Buzzoid - Buy Instagram Followers"/> </a> <p align="center" title="At Buzzoid, you can buy Instagram followers quickly, safely, and easily with just a few clicks. Rated world's #1 IG service since 2012.">At Buzzoid, you can buy Instagram followers quickly, safely, and easily with just a few clicks. Rate...</p> <p align="center"> <a href="https://buzzoid.com/buy-instagram-followers/?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship"><b>buzzoid.com</b></a> </p>
|
||||
</td><td align="center" width="33.333333333333336%"> <a href="https://www.famety.com/?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block"> <img width="70px" height="70px" src="https://axios-http.com/assets/sponsors/opencollective/famety-buy-instagram-followers.png" alt="Famety - Buy Instagram Followers"/> </a> <p align="center" title="At Famety, you can grow your social media following quickly, safely, and easily with just a few clicks. Rated the world’s #1 social media service since 2013.">At Famety, you can grow your social media following quickly, safely, and easily with just a few clic...</p> <p align="center"> <a href="https://www.famety.com/?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship"><b>www.famety.com</b></a> </p>
|
||||
</td><td align="center" width="33.333333333333336%"> <a href="https://poprey.com/?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block"> <img width="70px" height="70px" src="https://axios-http.com/assets/sponsors/opencollective/instagram-likes.png" alt="Poprey - Buy Instagram Likes"/> </a> <p align="center" title="Buy Instagram Likes">Buy Instagram Likes</p> <p align="center"> <a href="https://poprey.com/?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship"><b>poprey.com</b></a> </p>
|
||||
</td></tr><tr width="33.333333333333336%"><td align="center" width="33.333333333333336%"> <a href="https://musicza.co.za/?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block"> <img width="124px" height="52px" src="https://axios-http.com/assets/sponsors/opencollective/musicza.png" alt="Tubidy"/> </a> <p align="center" title="Tubidy: Free Music and Video Downloads | MP3, MP4">Tubidy: Free Music and Video Downloads | MP3, MP4</p> <p align="center"> <a href="https://musicza.co.za/?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship"><b>musicza.co.za</b></a> </p>
|
||||
</td><td align="center" width="33.333333333333336%"> <a href="https://ssmarket.net/buy-youtube-subscribers?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block"> <img width="70px" height="70px" src="https://axios-http.com/assets/sponsors/opencollective/youtube-subscribers-ssmarket.png" alt="Buy Youtube Subscribers"/> </a> <p align="center" title="SS Market offers professional social media services that rapidly increase your YouTube subscriber count, elevating your channel to a powerful position.">SS Market offers professional social media services that rapidly increase your YouTube subscriber co...</p> <p align="center"> <a href="https://ssmarket.net/buy-youtube-subscribers?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship"><b>ssmarket.net</b></a> </p>
|
||||
</td><td align="center" width="33.333333333333336%"> <a href="https://twicsy.com/buy-instagram-followers?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block"> <img width="85px" height="70px" src="https://axios-http.com/assets/sponsors/opencollective/buy-instagram-followers-twicsy.png" alt="Buy Instagram Followers Twicsy"/> </a> <p align="center" title="Buy real Instagram followers from Twicsy starting at only $2.97. Twicsy has been voted the best site to buy followers from the likes of US Magazine.">Buy real Instagram followers from Twicsy starting at only $2.97. Twicsy has been voted the best site...</p> <p align="center"> <a href="https://twicsy.com/buy-instagram-followers?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship"><b>twicsy.com</b></a> </p>
|
||||
</td></tr><tr width="33.333333333333336%"><td align="center" width="33.333333333333336%"> <a href="https://opencollective.com/axios/contribute">💜 Become a sponsor</a>
|
||||
</td><td align="center" width="33.333333333333336%"> <a href="https://opencollective.com/axios/contribute">💜 Become a sponsor</a>
|
||||
</td><td align="center" width="33.333333333333336%"> <a href="https://opencollective.com/axios/contribute">💜 Become a sponsor</a>
|
||||
</td></tr></table>
|
||||
|
||||
<!--<div>marker</div>-->
|
||||
<br><br>
|
||||
<div align="center">
|
||||
<a href="https://axios-http.com"><img src="https://axios-http.com/assets/logo.svg" /></a><br>
|
||||
@@ -109,6 +82,7 @@
|
||||
- [🆕 Progress capturing](#-progress-capturing)
|
||||
- [🆕 Rate limiting](#-progress-capturing)
|
||||
- [🆕 AxiosHeaders](#-axiosheaders)
|
||||
- [🔥 Fetch adapter](#-fetch-adapter)
|
||||
- [Semver](#semver)
|
||||
- [Promises](#promises)
|
||||
- [TypeScript](#typescript)
|
||||
@@ -130,8 +104,8 @@
|
||||
|
||||
## Browser Support
|
||||
|
||||
 |  |  |  |  |  |
|
||||
--- | --- | --- | --- | --- | --- |
|
||||
 |  |  |  |  |
|
||||
--- | --- | --- | --- | --- |
|
||||
Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11 ✔ |
|
||||
|
||||
[](https://saucelabs.com/u/axios)
|
||||
@@ -164,6 +138,12 @@ Using pnpm:
|
||||
$ pnpm add axios
|
||||
```
|
||||
|
||||
Using bun:
|
||||
|
||||
```bash
|
||||
$ bun add axios
|
||||
```
|
||||
|
||||
Once the package is installed, you can import the library using `import` or `require` approach:
|
||||
|
||||
```js
|
||||
@@ -186,6 +166,12 @@ const axios = require('axios');
|
||||
console.log(axios.isCancel('something'));
|
||||
```
|
||||
|
||||
For some bundlers and some ES6 linters you may need to do the following:
|
||||
|
||||
```js
|
||||
import { default as axios } from 'axios';
|
||||
```
|
||||
|
||||
For cases where something went wrong when trying to import a module into a custom or legacy environment,
|
||||
you can try importing the module package directly:
|
||||
|
||||
@@ -199,13 +185,13 @@ const axios = require('axios/dist/browser/axios.cjs'); // browser commonJS bundl
|
||||
Using jsDelivr CDN (ES5 UMD browser module):
|
||||
|
||||
```html
|
||||
<script src="https://cdn.jsdelivr.net/npm/axios@1.1.2/dist/axios.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/axios@1.6.7/dist/axios.min.js"></script>
|
||||
```
|
||||
|
||||
Using unpkg CDN:
|
||||
|
||||
```html
|
||||
<script src="https://unpkg.com/axios@1.1.2/dist/axios.min.js"></script>
|
||||
<script src="https://unpkg.com/axios@1.6.7/dist/axios.min.js"></script>
|
||||
```
|
||||
|
||||
## Example
|
||||
@@ -395,11 +381,16 @@ These are the available config options for making requests. Only the `url` is re
|
||||
// `method` is the request method to be used when making the request
|
||||
method: 'get', // default
|
||||
|
||||
// `baseURL` will be prepended to `url` unless `url` is absolute.
|
||||
// `baseURL` will be prepended to `url` unless `url` is absolute and option `allowAbsoluteUrls` is set to true.
|
||||
// It can be convenient to set `baseURL` for an instance of axios to pass relative URLs
|
||||
// to methods of that instance.
|
||||
baseURL: 'https://some-domain.com/api/',
|
||||
|
||||
// `allowAbsoluteUrls` determines whether or not absolute URLs will override a configured `baseUrl`.
|
||||
// When set to true (default), absolute values for `url` will override `baseUrl`.
|
||||
// When set to false, absolute values for `url` will always be prepended by `baseUrl`.
|
||||
allowAbsoluteUrls: true,
|
||||
|
||||
// `transformRequest` allows changes to the request data before it is sent to the server
|
||||
// This is only applicable for request methods 'PUT', 'POST', 'PATCH' and 'DELETE'
|
||||
// The last function in the array must return a string or an instance of Buffer, ArrayBuffer,
|
||||
@@ -431,13 +422,13 @@ These are the available config options for making requests. Only the `url` is re
|
||||
// `paramsSerializer` is an optional config that allows you to customize serializing `params`.
|
||||
paramsSerializer: {
|
||||
|
||||
//Custom encoder function which sends key/value pairs in an iterative fashion.
|
||||
// Custom encoder function which sends key/value pairs in an iterative fashion.
|
||||
encode?: (param: string): string => { /* Do custom operations here and return transformed string */ },
|
||||
|
||||
// Custom serializer function for the entire parameter. Allows user to mimic pre 1.x behaviour.
|
||||
serialize?: (params: Record<string, any>, options?: ParamsSerializerOptions ),
|
||||
|
||||
//Configuration for formatting array indexes in the params.
|
||||
// Configuration for formatting array indexes in the params.
|
||||
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).
|
||||
},
|
||||
|
||||
@@ -465,10 +456,13 @@ These are the available config options for making requests. Only the `url` is re
|
||||
withCredentials: false, // default
|
||||
|
||||
// `adapter` allows custom handling of requests which makes testing easier.
|
||||
// Return a promise and supply a valid response (see lib/adapters/README.md).
|
||||
// Return a promise and supply a valid response (see lib/adapters/README.md)
|
||||
adapter: function (config) {
|
||||
/* ... */
|
||||
},
|
||||
// Also, you can set the name of the built-in adapter, or provide an array with their names
|
||||
// to choose the first available in the environment
|
||||
adapter: 'xhr', // 'fetch' | 'http' | ['xhr', 'http', 'fetch']
|
||||
|
||||
// `auth` indicates that HTTP Basic auth should be used, and supplies credentials.
|
||||
// This will set an `Authorization` header, overwriting any existing
|
||||
@@ -487,6 +481,9 @@ These are the available config options for making requests. Only the `url` is re
|
||||
|
||||
// `responseEncoding` indicates encoding to use for decoding responses (Node.js only)
|
||||
// Note: Ignored for `responseType` of 'stream' or client-side requests
|
||||
// options are: 'ascii', 'ASCII', 'ansi', 'ANSI', 'binary', 'BINARY', 'base64', 'BASE64', 'base64url',
|
||||
// 'BASE64URL', 'hex', 'HEX', 'latin1', 'LATIN1', 'ucs-2', 'UCS-2', 'ucs2', 'UCS2', 'utf-8', 'UTF-8',
|
||||
// 'utf8', 'UTF8', 'utf16le', 'UTF16LE'
|
||||
responseEncoding: 'utf8', // default
|
||||
|
||||
// `xsrfCookieName` is the name of the cookie to use as a value for xsrf token
|
||||
@@ -545,7 +542,11 @@ These are the available config options for making requests. Only the `url` is re
|
||||
// If both are specified, `socketPath` is used.
|
||||
socketPath: null, // default
|
||||
|
||||
// `transport` determines the transport method that will be used to make the request. If defined, it will be used. Otherwise, if `maxRedirects` is 0, the default `http` or `https` library will be used, depending on the protocol specified in `protocol`. Otherwise, the `httpFollow` or `httpsFollow` library will be used, again depending on the protocol, which can handle redirects.
|
||||
// `transport` determines the transport method that will be used to make the request.
|
||||
// If defined, it will be used. Otherwise, if `maxRedirects` is 0,
|
||||
// the default `http` or `https` library will be used, depending on the protocol specified in `protocol`.
|
||||
// Otherwise, the `httpFollow` or `httpsFollow` library will be used, again depending on the protocol,
|
||||
// which can handle redirects.
|
||||
transport: undefined, // default
|
||||
|
||||
// `httpAgent` and `httpsAgent` define a custom agent to be used when performing http
|
||||
@@ -707,7 +708,7 @@ instance.defaults.headers.common['Authorization'] = AUTH_TOKEN;
|
||||
|
||||
### Config order of precedence
|
||||
|
||||
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/index.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.
|
||||
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.
|
||||
|
||||
```js
|
||||
// Create an instance using the config defaults provided by the library
|
||||
@@ -729,8 +730,11 @@ instance.get('/longRequest', {
|
||||
You can intercept requests or responses before they are handled by `then` or `catch`.
|
||||
|
||||
```js
|
||||
|
||||
const instance = axios.create();
|
||||
|
||||
// Add a request interceptor
|
||||
axios.interceptors.request.use(function (config) {
|
||||
instance.interceptors.request.use(function (config) {
|
||||
// Do something before request is sent
|
||||
return config;
|
||||
}, function (error) {
|
||||
@@ -739,7 +743,7 @@ axios.interceptors.request.use(function (config) {
|
||||
});
|
||||
|
||||
// Add a response interceptor
|
||||
axios.interceptors.response.use(function (response) {
|
||||
instance.interceptors.response.use(function (response) {
|
||||
// Any status code that lie within the range of 2xx cause this function to trigger
|
||||
// Do something with response data
|
||||
return response;
|
||||
@@ -753,7 +757,8 @@ axios.interceptors.response.use(function (response) {
|
||||
If you need to remove an interceptor later you can.
|
||||
|
||||
```js
|
||||
const myInterceptor = axios.interceptors.request.use(function () {/*...*/});
|
||||
const instance = axios.create();
|
||||
const myInterceptor = instance.interceptors.request.use(function () {/*...*/});
|
||||
axios.interceptors.request.eject(myInterceptor);
|
||||
```
|
||||
|
||||
@@ -786,7 +791,7 @@ axios.interceptors.request.use(function (config) {
|
||||
```
|
||||
|
||||
If you want to execute a particular interceptor based on a runtime check,
|
||||
you can add a `runWhen` function to the options object. The interceptor will not be executed **if and only if** the return
|
||||
you can add a `runWhen` function to the options object. The request interceptor will not be executed **if and only if** the return
|
||||
of `runWhen` is `false`. The function will be called with the config
|
||||
object (don't forget that you can bind your own arguments to it as well.) This can be handy when you have an
|
||||
asynchronous request interceptor that only needs to run at certain times.
|
||||
@@ -801,6 +806,8 @@ axios.interceptors.request.use(function (config) {
|
||||
}, null, { runWhen: onGetCall });
|
||||
```
|
||||
|
||||
> **Note:** options parameter(having `synchronous` and `runWhen` properties) is only supported for request interceptors at the moment.
|
||||
|
||||
### Multiple Interceptors
|
||||
|
||||
Given you add multiple response interceptors
|
||||
@@ -830,7 +837,7 @@ The general structure of axios errors is as follows:
|
||||
| code | Represents an axios identified error. The table below lists out specific definitions for internal axios error. |
|
||||
| status | HTTP response status code. See [here](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes) for common HTTP response status code meanings.
|
||||
|
||||
Below is a list of potential axios identified error
|
||||
Below is a list of potential axios identified error:
|
||||
| Code | Definition |
|
||||
| -------- | ---------- |
|
||||
| ERR_BAD_OPTION_VALUE | Invalid or unsupported value provided in axios configuration. |
|
||||
@@ -1141,7 +1148,7 @@ to a `FormData` object by following custom rules.
|
||||
- `metaTokens: boolean = true` - add the special ending (e.g `user{}: '{"name": "John"}'`) in the FormData key.
|
||||
The back-end body-parser could potentially use this meta-information to automatically parse the value as JSON.
|
||||
|
||||
- `indexes: null|false|true = false` - controls how indexes will be added to unwrapped keys of `flat` array-like objects
|
||||
- `indexes: null|false|true = false` - controls how indexes will be added to unwrapped keys of `flat` array-like objects.
|
||||
|
||||
- `null` - don't add brackets (`arr: 1`, `arr: 2`, `arr: 3`)
|
||||
- `false`(default) - add empty brackets (`arr[]: 1`, `arr[]: 2`, `arr[]: 3`)
|
||||
@@ -1270,6 +1277,7 @@ Sending `Blobs`/`Files` as JSON (`base64`) is not currently supported.
|
||||
## 🆕 Progress capturing
|
||||
|
||||
Axios supports both browser and node environments to capture request upload/download progress.
|
||||
The frequency of progress events is forced to be limited to `3` times per second.
|
||||
|
||||
```js
|
||||
await axios.post(url, data, {
|
||||
@@ -1590,6 +1598,30 @@ The following shortcuts are available:
|
||||
|
||||
- `setContentEncoding`, `getContentEncoding`, `hasContentEncoding`
|
||||
|
||||
## 🔥 Fetch adapter
|
||||
|
||||
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,
|
||||
or not supported by the environment.
|
||||
To use it by default, it must be selected explicitly:
|
||||
|
||||
```js
|
||||
const {data} = axios.get(url, {
|
||||
adapter: 'fetch' // by default ['xhr', 'http', 'fetch']
|
||||
})
|
||||
```
|
||||
|
||||
You can create a separate instance for this:
|
||||
|
||||
```js
|
||||
const fetchAxios = axios.create({
|
||||
adapter: 'fetch'
|
||||
});
|
||||
|
||||
const {data} = fetchAxios.get(url);
|
||||
```
|
||||
|
||||
The adapter supports the same functionality as `xhr` adapter, **including upload and download progress capturing**.
|
||||
Also, it supports additional response types such as `stream` and `formdata` (if supported by the environment).
|
||||
|
||||
## Semver
|
||||
|
||||
|
||||
6
node_modules/axios/SECURITY.md
generated
vendored
6
node_modules/axios/SECURITY.md
generated
vendored
@@ -1,6 +0,0 @@
|
||||
# Reporting a Vulnerability
|
||||
|
||||
If you discover a security vulnerability in axios please disclose it via [our huntr page](https://huntr.dev/repos/axios/axios/). Bounty eligibility, CVE assignment, response times and past reports are all there.
|
||||
|
||||
|
||||
Thank you for improving the security of axios.
|
||||
2068
node_modules/axios/dist/axios.js
generated
vendored
2068
node_modules/axios/dist/axios.js
generated
vendored
File diff suppressed because it is too large
Load Diff
2
node_modules/axios/dist/axios.js.map
generated
vendored
2
node_modules/axios/dist/axios.js.map
generated
vendored
File diff suppressed because one or more lines are too long
3
node_modules/axios/dist/axios.min.js
generated
vendored
3
node_modules/axios/dist/axios.min.js
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/axios/dist/axios.min.js.map
generated
vendored
2
node_modules/axios/dist/axios.min.js.map
generated
vendored
File diff suppressed because one or more lines are too long
1144
node_modules/axios/dist/browser/axios.cjs
generated
vendored
1144
node_modules/axios/dist/browser/axios.cjs
generated
vendored
File diff suppressed because it is too large
Load Diff
2
node_modules/axios/dist/browser/axios.cjs.map
generated
vendored
2
node_modules/axios/dist/browser/axios.cjs.map
generated
vendored
File diff suppressed because one or more lines are too long
1144
node_modules/axios/dist/esm/axios.js
generated
vendored
1144
node_modules/axios/dist/esm/axios.js
generated
vendored
File diff suppressed because it is too large
Load Diff
2
node_modules/axios/dist/esm/axios.js.map
generated
vendored
2
node_modules/axios/dist/esm/axios.js.map
generated
vendored
File diff suppressed because one or more lines are too long
3
node_modules/axios/dist/esm/axios.min.js
generated
vendored
3
node_modules/axios/dist/esm/axios.min.js
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/axios/dist/esm/axios.min.js.map
generated
vendored
2
node_modules/axios/dist/esm/axios.min.js.map
generated
vendored
File diff suppressed because one or more lines are too long
1330
node_modules/axios/dist/node/axios.cjs
generated
vendored
1330
node_modules/axios/dist/node/axios.cjs
generated
vendored
File diff suppressed because it is too large
Load Diff
2
node_modules/axios/dist/node/axios.cjs.map
generated
vendored
2
node_modules/axios/dist/node/axios.cjs.map
generated
vendored
File diff suppressed because one or more lines are too long
14
node_modules/axios/index.d.cts
generated
vendored
14
node_modules/axios/index.d.cts
generated
vendored
@@ -268,7 +268,8 @@ declare namespace axios {
|
||||
| 'document'
|
||||
| 'json'
|
||||
| 'text'
|
||||
| 'stream';
|
||||
| 'stream'
|
||||
| 'formdata';
|
||||
|
||||
type responseEncoding =
|
||||
| 'ascii' | 'ASCII'
|
||||
@@ -353,11 +354,12 @@ declare namespace axios {
|
||||
upload?: boolean;
|
||||
download?: boolean;
|
||||
event?: BrowserProgressEvent;
|
||||
lengthComputable: boolean;
|
||||
}
|
||||
|
||||
type Milliseconds = number;
|
||||
|
||||
type AxiosAdapterName = 'xhr' | 'http' | string;
|
||||
type AxiosAdapterName = 'fetch' | 'xhr' | 'http' | string;
|
||||
|
||||
type AxiosAdapterConfig = AxiosAdapter | AxiosAdapterName;
|
||||
|
||||
@@ -374,6 +376,7 @@ declare namespace axios {
|
||||
url?: string;
|
||||
method?: Method | string;
|
||||
baseURL?: string;
|
||||
allowAbsoluteUrls?: boolean;
|
||||
transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[];
|
||||
transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[];
|
||||
headers?: (RawAxiosRequestHeaders & MethodsHeaders) | AxiosHeaders;
|
||||
@@ -415,6 +418,7 @@ declare namespace axios {
|
||||
lookup?: ((hostname: string, options: object, cb: (err: Error | null, address: LookupAddress | LookupAddress[], family?: AddressFamily) => void) => void) |
|
||||
((hostname: string, options: object) => Promise<[address: LookupAddressEntry | LookupAddressEntry[], family?: AddressFamily] | LookupAddress>);
|
||||
withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined);
|
||||
fetchOptions?: Record<string, any>;
|
||||
}
|
||||
|
||||
// Alias
|
||||
@@ -490,8 +494,12 @@ declare namespace axios {
|
||||
runWhen?: (config: InternalAxiosRequestConfig) => boolean;
|
||||
}
|
||||
|
||||
type AxiosRequestInterceptorUse<T> = (onFulfilled?: ((value: T) => T | Promise<T>) | null, onRejected?: ((error: any) => any) | null, options?: AxiosInterceptorOptions) => number;
|
||||
|
||||
type AxiosResponseInterceptorUse<T> = (onFulfilled?: ((value: T) => T | Promise<T>) | null, onRejected?: ((error: any) => any) | null) => number;
|
||||
|
||||
interface AxiosInterceptorManager<V> {
|
||||
use(onFulfilled?: (value: V) => V | Promise<V>, onRejected?: (error: any) => any, options?: AxiosInterceptorOptions): number;
|
||||
use: V extends AxiosResponse ? AxiosResponseInterceptorUse<V> : AxiosRequestInterceptorUse<V>;
|
||||
eject(id: number): void;
|
||||
clear(): void;
|
||||
}
|
||||
|
||||
17
node_modules/axios/index.d.ts
generated
vendored
17
node_modules/axios/index.d.ts
generated
vendored
@@ -209,7 +209,8 @@ export type ResponseType =
|
||||
| 'document'
|
||||
| 'json'
|
||||
| 'text'
|
||||
| 'stream';
|
||||
| 'stream'
|
||||
| 'formdata';
|
||||
|
||||
export type responseEncoding =
|
||||
| 'ascii' | 'ASCII'
|
||||
@@ -294,11 +295,12 @@ export interface AxiosProgressEvent {
|
||||
upload?: boolean;
|
||||
download?: boolean;
|
||||
event?: BrowserProgressEvent;
|
||||
lengthComputable: boolean;
|
||||
}
|
||||
|
||||
type Milliseconds = number;
|
||||
|
||||
type AxiosAdapterName = 'xhr' | 'http' | string;
|
||||
type AxiosAdapterName = 'fetch' | 'xhr' | 'http' | string;
|
||||
|
||||
type AxiosAdapterConfig = AxiosAdapter | AxiosAdapterName;
|
||||
|
||||
@@ -315,6 +317,7 @@ export interface AxiosRequestConfig<D = any> {
|
||||
url?: string;
|
||||
method?: Method | string;
|
||||
baseURL?: string;
|
||||
allowAbsoluteUrls?: boolean;
|
||||
transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[];
|
||||
transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[];
|
||||
headers?: (RawAxiosRequestHeaders & MethodsHeaders) | AxiosHeaders;
|
||||
@@ -356,6 +359,7 @@ export interface AxiosRequestConfig<D = any> {
|
||||
lookup?: ((hostname: string, options: object, cb: (err: Error | null, address: LookupAddress | LookupAddress[], family?: AddressFamily) => void) => void) |
|
||||
((hostname: string, options: object) => Promise<[address: LookupAddressEntry | LookupAddressEntry[], family?: AddressFamily] | LookupAddress>);
|
||||
withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined);
|
||||
fetchOptions?: Record<string, any>;
|
||||
}
|
||||
|
||||
// Alias
|
||||
@@ -473,8 +477,12 @@ export interface AxiosInterceptorOptions {
|
||||
runWhen?: (config: InternalAxiosRequestConfig) => boolean;
|
||||
}
|
||||
|
||||
type AxiosRequestInterceptorUse<T> = (onFulfilled?: ((value: T) => T | Promise<T>) | null, onRejected?: ((error: any) => any) | null, options?: AxiosInterceptorOptions) => number;
|
||||
|
||||
type AxiosResponseInterceptorUse<T> = (onFulfilled?: ((value: T) => T | Promise<T>) | null, onRejected?: ((error: any) => any) | null) => number;
|
||||
|
||||
export interface AxiosInterceptorManager<V> {
|
||||
use(onFulfilled?: ((value: V) => V | Promise<V>) | null, onRejected?: ((error: any) => any) | null, options?: AxiosInterceptorOptions): number;
|
||||
use: V extends AxiosResponse ? AxiosResponseInterceptorUse<V> : AxiosRequestInterceptorUse<V>;
|
||||
eject(id: number): void;
|
||||
clear(): void;
|
||||
}
|
||||
@@ -535,6 +543,8 @@ export function isCancel(value: any): value is Cancel;
|
||||
|
||||
export function all<T>(values: Array<T | Promise<T>>): Promise<T[]>;
|
||||
|
||||
export function mergeConfig<D = any>(config1: AxiosRequestConfig<D>, config2: AxiosRequestConfig<D>): AxiosRequestConfig<D>;
|
||||
|
||||
export interface AxiosStatic extends AxiosInstance {
|
||||
create(config?: CreateAxiosDefaults): AxiosInstance;
|
||||
Cancel: CancelStatic;
|
||||
@@ -552,6 +562,7 @@ export interface AxiosStatic extends AxiosInstance {
|
||||
getAdapter: typeof getAdapter;
|
||||
CanceledError: typeof CanceledError;
|
||||
AxiosHeaders: typeof AxiosHeaders;
|
||||
mergeConfig: typeof mergeConfig;
|
||||
}
|
||||
|
||||
declare const axios: AxiosStatic;
|
||||
|
||||
4
node_modules/axios/lib/adapters/adapters.js
generated
vendored
4
node_modules/axios/lib/adapters/adapters.js
generated
vendored
@@ -1,11 +1,13 @@
|
||||
import utils from '../utils.js';
|
||||
import httpAdapter from './http.js';
|
||||
import xhrAdapter from './xhr.js';
|
||||
import fetchAdapter from './fetch.js';
|
||||
import AxiosError from "../core/AxiosError.js";
|
||||
|
||||
const knownAdapters = {
|
||||
http: httpAdapter,
|
||||
xhr: xhrAdapter
|
||||
xhr: xhrAdapter,
|
||||
fetch: fetchAdapter
|
||||
}
|
||||
|
||||
utils.forEach(knownAdapters, (fn, value) => {
|
||||
|
||||
229
node_modules/axios/lib/adapters/fetch.js
generated
vendored
Normal file
229
node_modules/axios/lib/adapters/fetch.js
generated
vendored
Normal file
@@ -0,0 +1,229 @@
|
||||
import platform from "../platform/index.js";
|
||||
import utils from "../utils.js";
|
||||
import AxiosError from "../core/AxiosError.js";
|
||||
import composeSignals from "../helpers/composeSignals.js";
|
||||
import {trackStream} from "../helpers/trackStream.js";
|
||||
import AxiosHeaders from "../core/AxiosHeaders.js";
|
||||
import {progressEventReducer, progressEventDecorator, asyncDecorator} from "../helpers/progressEventReducer.js";
|
||||
import resolveConfig from "../helpers/resolveConfig.js";
|
||||
import settle from "../core/settle.js";
|
||||
|
||||
const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
|
||||
const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
|
||||
|
||||
// used only inside the fetch adapter
|
||||
const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
|
||||
((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
|
||||
async (str) => new Uint8Array(await new Response(str).arrayBuffer())
|
||||
);
|
||||
|
||||
const test = (fn, ...args) => {
|
||||
try {
|
||||
return !!fn(...args);
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
const supportsRequestStream = isReadableStreamSupported && test(() => {
|
||||
let duplexAccessed = false;
|
||||
|
||||
const hasContentType = new Request(platform.origin, {
|
||||
body: new ReadableStream(),
|
||||
method: 'POST',
|
||||
get duplex() {
|
||||
duplexAccessed = true;
|
||||
return 'half';
|
||||
},
|
||||
}).headers.has('Content-Type');
|
||||
|
||||
return duplexAccessed && !hasContentType;
|
||||
});
|
||||
|
||||
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
||||
|
||||
const supportsResponseStream = isReadableStreamSupported &&
|
||||
test(() => utils.isReadableStream(new Response('').body));
|
||||
|
||||
|
||||
const resolvers = {
|
||||
stream: supportsResponseStream && ((res) => res.body)
|
||||
};
|
||||
|
||||
isFetchSupported && (((res) => {
|
||||
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
|
||||
!resolvers[type] && (resolvers[type] = utils.isFunction(res[type]) ? (res) => res[type]() :
|
||||
(_, config) => {
|
||||
throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
|
||||
})
|
||||
});
|
||||
})(new Response));
|
||||
|
||||
const getBodyLength = async (body) => {
|
||||
if (body == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(utils.isBlob(body)) {
|
||||
return body.size;
|
||||
}
|
||||
|
||||
if(utils.isSpecCompliantForm(body)) {
|
||||
const _request = new Request(platform.origin, {
|
||||
method: 'POST',
|
||||
body,
|
||||
});
|
||||
return (await _request.arrayBuffer()).byteLength;
|
||||
}
|
||||
|
||||
if(utils.isArrayBufferView(body) || utils.isArrayBuffer(body)) {
|
||||
return body.byteLength;
|
||||
}
|
||||
|
||||
if(utils.isURLSearchParams(body)) {
|
||||
body = body + '';
|
||||
}
|
||||
|
||||
if(utils.isString(body)) {
|
||||
return (await encodeText(body)).byteLength;
|
||||
}
|
||||
}
|
||||
|
||||
const resolveBodyLength = async (headers, body) => {
|
||||
const length = utils.toFiniteNumber(headers.getContentLength());
|
||||
|
||||
return length == null ? getBodyLength(body) : length;
|
||||
}
|
||||
|
||||
export default isFetchSupported && (async (config) => {
|
||||
let {
|
||||
url,
|
||||
method,
|
||||
data,
|
||||
signal,
|
||||
cancelToken,
|
||||
timeout,
|
||||
onDownloadProgress,
|
||||
onUploadProgress,
|
||||
responseType,
|
||||
headers,
|
||||
withCredentials = 'same-origin',
|
||||
fetchOptions
|
||||
} = resolveConfig(config);
|
||||
|
||||
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
||||
|
||||
let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
||||
|
||||
let request;
|
||||
|
||||
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
||||
composedSignal.unsubscribe();
|
||||
});
|
||||
|
||||
let requestContentLength;
|
||||
|
||||
try {
|
||||
if (
|
||||
onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
|
||||
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
||||
) {
|
||||
let _request = new Request(url, {
|
||||
method: 'POST',
|
||||
body: data,
|
||||
duplex: "half"
|
||||
});
|
||||
|
||||
let contentTypeHeader;
|
||||
|
||||
if (utils.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
|
||||
headers.setContentType(contentTypeHeader)
|
||||
}
|
||||
|
||||
if (_request.body) {
|
||||
const [onProgress, flush] = progressEventDecorator(
|
||||
requestContentLength,
|
||||
progressEventReducer(asyncDecorator(onUploadProgress))
|
||||
);
|
||||
|
||||
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
||||
}
|
||||
}
|
||||
|
||||
if (!utils.isString(withCredentials)) {
|
||||
withCredentials = withCredentials ? 'include' : 'omit';
|
||||
}
|
||||
|
||||
// Cloudflare Workers throws when credentials are defined
|
||||
// see https://github.com/cloudflare/workerd/issues/902
|
||||
const isCredentialsSupported = "credentials" in Request.prototype;
|
||||
request = new Request(url, {
|
||||
...fetchOptions,
|
||||
signal: composedSignal,
|
||||
method: method.toUpperCase(),
|
||||
headers: headers.normalize().toJSON(),
|
||||
body: data,
|
||||
duplex: "half",
|
||||
credentials: isCredentialsSupported ? withCredentials : undefined
|
||||
});
|
||||
|
||||
let response = await fetch(request);
|
||||
|
||||
const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
||||
|
||||
if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
|
||||
const options = {};
|
||||
|
||||
['status', 'statusText', 'headers'].forEach(prop => {
|
||||
options[prop] = response[prop];
|
||||
});
|
||||
|
||||
const responseContentLength = utils.toFiniteNumber(response.headers.get('content-length'));
|
||||
|
||||
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
||||
responseContentLength,
|
||||
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
||||
) || [];
|
||||
|
||||
response = new Response(
|
||||
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
||||
flush && flush();
|
||||
unsubscribe && unsubscribe();
|
||||
}),
|
||||
options
|
||||
);
|
||||
}
|
||||
|
||||
responseType = responseType || 'text';
|
||||
|
||||
let responseData = await resolvers[utils.findKey(resolvers, responseType) || 'text'](response, config);
|
||||
|
||||
!isStreamResponse && unsubscribe && unsubscribe();
|
||||
|
||||
return await new Promise((resolve, reject) => {
|
||||
settle(resolve, reject, {
|
||||
data: responseData,
|
||||
headers: AxiosHeaders.from(response.headers),
|
||||
status: response.status,
|
||||
statusText: response.statusText,
|
||||
config,
|
||||
request
|
||||
})
|
||||
})
|
||||
} catch (err) {
|
||||
unsubscribe && unsubscribe();
|
||||
|
||||
if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
|
||||
throw Object.assign(
|
||||
new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
|
||||
{
|
||||
cause: err.cause || err
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
throw AxiosError.from(err, err && err.code, config, request);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
56
node_modules/axios/lib/adapters/http.js
generated
vendored
Normal file → Executable file
56
node_modules/axios/lib/adapters/http.js
generated
vendored
Normal file → Executable file
@@ -4,7 +4,7 @@ import utils from './../utils.js';
|
||||
import settle from './../core/settle.js';
|
||||
import buildFullPath from '../core/buildFullPath.js';
|
||||
import buildURL from './../helpers/buildURL.js';
|
||||
import {getProxyForUrl} from 'proxy-from-env';
|
||||
import proxyFromEnv from 'proxy-from-env';
|
||||
import http from 'http';
|
||||
import https from 'https';
|
||||
import util from 'util';
|
||||
@@ -19,11 +19,12 @@ import fromDataURI from '../helpers/fromDataURI.js';
|
||||
import stream from 'stream';
|
||||
import AxiosHeaders from '../core/AxiosHeaders.js';
|
||||
import AxiosTransformStream from '../helpers/AxiosTransformStream.js';
|
||||
import EventEmitter from 'events';
|
||||
import {EventEmitter} from 'events';
|
||||
import formDataToStream from "../helpers/formDataToStream.js";
|
||||
import readBlob from "../helpers/readBlob.js";
|
||||
import ZlibHeaderTransformStream from '../helpers/ZlibHeaderTransformStream.js';
|
||||
import callbackify from "../helpers/callbackify.js";
|
||||
import {progressEventReducer, progressEventDecorator, asyncDecorator} from "../helpers/progressEventReducer.js";
|
||||
|
||||
const zlibOptions = {
|
||||
flush: zlib.constants.Z_SYNC_FLUSH,
|
||||
@@ -45,6 +46,14 @@ const supportedProtocols = platform.protocols.map(protocol => {
|
||||
return protocol + ':';
|
||||
});
|
||||
|
||||
const flushOnFinish = (stream, [throttled, flush]) => {
|
||||
stream
|
||||
.on('end', flush)
|
||||
.on('error', flush);
|
||||
|
||||
return throttled;
|
||||
}
|
||||
|
||||
/**
|
||||
* If the proxy or config beforeRedirects functions are defined, call them with the options
|
||||
* object.
|
||||
@@ -74,7 +83,7 @@ function dispatchBeforeRedirect(options, responseDetails) {
|
||||
function setProxy(options, configProxy, location) {
|
||||
let proxy = configProxy;
|
||||
if (!proxy && proxy !== false) {
|
||||
const proxyUrl = getProxyForUrl(location);
|
||||
const proxyUrl = proxyFromEnv.getProxyForUrl(location);
|
||||
if (proxyUrl) {
|
||||
proxy = new URL(proxyUrl);
|
||||
}
|
||||
@@ -219,8 +228,8 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
||||
}
|
||||
|
||||
// Parse url
|
||||
const fullPath = buildFullPath(config.baseURL, config.url);
|
||||
const parsed = new URL(fullPath, 'http://localhost');
|
||||
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
|
||||
const parsed = new URL(fullPath, platform.hasBrowserEnv ? platform.origin : undefined);
|
||||
const protocol = parsed.protocol || supportedProtocols[0];
|
||||
|
||||
if (protocol === 'data:') {
|
||||
@@ -278,8 +287,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
||||
// Only set header if it hasn't been set in config
|
||||
headers.set('User-Agent', 'axios/' + VERSION, false);
|
||||
|
||||
const onDownloadProgress = config.onDownloadProgress;
|
||||
const onUploadProgress = config.onUploadProgress;
|
||||
const {onUploadProgress, onDownloadProgress} = config;
|
||||
const maxRate = config.maxRate;
|
||||
let maxUploadRate = undefined;
|
||||
let maxDownloadRate = undefined;
|
||||
@@ -306,7 +314,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
} else if (utils.isBlob(data)) {
|
||||
} else if (utils.isBlob(data) || utils.isFile(data)) {
|
||||
data.size && headers.setContentType(data.type || 'application/octet-stream');
|
||||
headers.setContentLength(data.size || 0);
|
||||
data = stream.Readable.from(readBlob(data));
|
||||
@@ -352,15 +360,16 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
||||
}
|
||||
|
||||
data = stream.pipeline([data, new AxiosTransformStream({
|
||||
length: contentLength,
|
||||
maxRate: utils.toFiniteNumber(maxUploadRate)
|
||||
})], utils.noop);
|
||||
|
||||
onUploadProgress && data.on('progress', progress => {
|
||||
onUploadProgress(Object.assign(progress, {
|
||||
upload: true
|
||||
}));
|
||||
});
|
||||
onUploadProgress && data.on('progress', flushOnFinish(
|
||||
data,
|
||||
progressEventDecorator(
|
||||
contentLength,
|
||||
progressEventReducer(asyncDecorator(onUploadProgress), false, 3)
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
// HTTP basic authentication
|
||||
@@ -418,7 +427,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
||||
if (config.socketPath) {
|
||||
options.socketPath = config.socketPath;
|
||||
} else {
|
||||
options.hostname = parsed.hostname;
|
||||
options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
|
||||
options.port = parsed.port;
|
||||
setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
|
||||
}
|
||||
@@ -459,17 +468,18 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
||||
|
||||
const responseLength = +res.headers['content-length'];
|
||||
|
||||
if (onDownloadProgress) {
|
||||
if (onDownloadProgress || maxDownloadRate) {
|
||||
const transformStream = new AxiosTransformStream({
|
||||
length: utils.toFiniteNumber(responseLength),
|
||||
maxRate: utils.toFiniteNumber(maxDownloadRate)
|
||||
});
|
||||
|
||||
onDownloadProgress && transformStream.on('progress', progress => {
|
||||
onDownloadProgress(Object.assign(progress, {
|
||||
download: true
|
||||
}));
|
||||
});
|
||||
onDownloadProgress && transformStream.on('progress', flushOnFinish(
|
||||
transformStream,
|
||||
progressEventDecorator(
|
||||
responseLength,
|
||||
progressEventReducer(asyncDecorator(onDownloadProgress), true, 3)
|
||||
)
|
||||
));
|
||||
|
||||
streams.push(transformStream);
|
||||
}
|
||||
@@ -559,7 +569,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
||||
}
|
||||
|
||||
const err = new AxiosError(
|
||||
'maxContentLength size of ' + config.maxContentLength + ' exceeded',
|
||||
'stream has been aborted',
|
||||
AxiosError.ERR_BAD_RESPONSE,
|
||||
config,
|
||||
lastRequest
|
||||
|
||||
135
node_modules/axios/lib/adapters/xhr.js
generated
vendored
135
node_modules/axios/lib/adapters/xhr.js
generated
vendored
@@ -1,93 +1,41 @@
|
||||
'use strict';
|
||||
|
||||
import utils from './../utils.js';
|
||||
import settle from './../core/settle.js';
|
||||
import cookies from './../helpers/cookies.js';
|
||||
import buildURL from './../helpers/buildURL.js';
|
||||
import buildFullPath from '../core/buildFullPath.js';
|
||||
import isURLSameOrigin from './../helpers/isURLSameOrigin.js';
|
||||
import transitionalDefaults from '../defaults/transitional.js';
|
||||
import AxiosError from '../core/AxiosError.js';
|
||||
import CanceledError from '../cancel/CanceledError.js';
|
||||
import parseProtocol from '../helpers/parseProtocol.js';
|
||||
import platform from '../platform/index.js';
|
||||
import AxiosHeaders from '../core/AxiosHeaders.js';
|
||||
import speedometer from '../helpers/speedometer.js';
|
||||
|
||||
function progressEventReducer(listener, isDownloadStream) {
|
||||
let bytesNotified = 0;
|
||||
const _speedometer = speedometer(50, 250);
|
||||
|
||||
return e => {
|
||||
const loaded = e.loaded;
|
||||
const total = e.lengthComputable ? e.total : undefined;
|
||||
const progressBytes = loaded - bytesNotified;
|
||||
const rate = _speedometer(progressBytes);
|
||||
const inRange = loaded <= total;
|
||||
|
||||
bytesNotified = loaded;
|
||||
|
||||
const data = {
|
||||
loaded,
|
||||
total,
|
||||
progress: total ? (loaded / total) : undefined,
|
||||
bytes: progressBytes,
|
||||
rate: rate ? rate : undefined,
|
||||
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
||||
event: e
|
||||
};
|
||||
|
||||
data[isDownloadStream ? 'download' : 'upload'] = true;
|
||||
|
||||
listener(data);
|
||||
};
|
||||
}
|
||||
import {progressEventReducer} from '../helpers/progressEventReducer.js';
|
||||
import resolveConfig from "../helpers/resolveConfig.js";
|
||||
|
||||
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
||||
|
||||
export default isXHRAdapterSupported && function (config) {
|
||||
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
||||
let requestData = config.data;
|
||||
const requestHeaders = AxiosHeaders.from(config.headers).normalize();
|
||||
let {responseType, withXSRFToken} = config;
|
||||
const _config = resolveConfig(config);
|
||||
let requestData = _config.data;
|
||||
const requestHeaders = AxiosHeaders.from(_config.headers).normalize();
|
||||
let {responseType, onUploadProgress, onDownloadProgress} = _config;
|
||||
let onCanceled;
|
||||
let uploadThrottled, downloadThrottled;
|
||||
let flushUpload, flushDownload;
|
||||
|
||||
function done() {
|
||||
if (config.cancelToken) {
|
||||
config.cancelToken.unsubscribe(onCanceled);
|
||||
}
|
||||
flushUpload && flushUpload(); // flush events
|
||||
flushDownload && flushDownload(); // flush events
|
||||
|
||||
if (config.signal) {
|
||||
config.signal.removeEventListener('abort', onCanceled);
|
||||
}
|
||||
}
|
||||
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
|
||||
|
||||
let contentType;
|
||||
|
||||
if (utils.isFormData(requestData)) {
|
||||
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
||||
requestHeaders.setContentType(false); // Let the browser set it
|
||||
} else if ((contentType = requestHeaders.getContentType()) !== false) {
|
||||
// fix semicolon duplication issue for ReactNative FormData implementation
|
||||
const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
|
||||
requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
|
||||
}
|
||||
_config.signal && _config.signal.removeEventListener('abort', onCanceled);
|
||||
}
|
||||
|
||||
let request = new XMLHttpRequest();
|
||||
|
||||
// HTTP basic authentication
|
||||
if (config.auth) {
|
||||
const username = config.auth.username || '';
|
||||
const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
|
||||
requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
|
||||
}
|
||||
|
||||
const fullPath = buildFullPath(config.baseURL, config.url);
|
||||
|
||||
request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
|
||||
request.open(_config.method.toUpperCase(), _config.url, true);
|
||||
|
||||
// Set the request timeout in MS
|
||||
request.timeout = config.timeout;
|
||||
request.timeout = _config.timeout;
|
||||
|
||||
function onloadend() {
|
||||
if (!request) {
|
||||
@@ -167,10 +115,10 @@ export default isXHRAdapterSupported && function (config) {
|
||||
|
||||
// Handle timeout
|
||||
request.ontimeout = function handleTimeout() {
|
||||
let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
|
||||
const transitional = config.transitional || transitionalDefaults;
|
||||
if (config.timeoutErrorMessage) {
|
||||
timeoutErrorMessage = config.timeoutErrorMessage;
|
||||
let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
|
||||
const transitional = _config.transitional || transitionalDefaults;
|
||||
if (_config.timeoutErrorMessage) {
|
||||
timeoutErrorMessage = _config.timeoutErrorMessage;
|
||||
}
|
||||
reject(new AxiosError(
|
||||
timeoutErrorMessage,
|
||||
@@ -182,22 +130,6 @@ export default isXHRAdapterSupported && function (config) {
|
||||
request = null;
|
||||
};
|
||||
|
||||
// Add xsrf header
|
||||
// This is only done if running in a standard browser environment.
|
||||
// Specifically not if we're in a web worker, or react-native.
|
||||
if(platform.hasStandardBrowserEnv) {
|
||||
withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
|
||||
|
||||
if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
|
||||
// Add xsrf header
|
||||
const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
||||
|
||||
if (xsrfValue) {
|
||||
requestHeaders.set(config.xsrfHeaderName, xsrfValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove Content-Type if data is undefined
|
||||
requestData === undefined && requestHeaders.setContentType(null);
|
||||
|
||||
@@ -209,26 +141,31 @@ export default isXHRAdapterSupported && function (config) {
|
||||
}
|
||||
|
||||
// Add withCredentials to request if needed
|
||||
if (!utils.isUndefined(config.withCredentials)) {
|
||||
request.withCredentials = !!config.withCredentials;
|
||||
if (!utils.isUndefined(_config.withCredentials)) {
|
||||
request.withCredentials = !!_config.withCredentials;
|
||||
}
|
||||
|
||||
// Add responseType to request if needed
|
||||
if (responseType && responseType !== 'json') {
|
||||
request.responseType = config.responseType;
|
||||
request.responseType = _config.responseType;
|
||||
}
|
||||
|
||||
// Handle progress if needed
|
||||
if (typeof config.onDownloadProgress === 'function') {
|
||||
request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
|
||||
if (onDownloadProgress) {
|
||||
([downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true));
|
||||
request.addEventListener('progress', downloadThrottled);
|
||||
}
|
||||
|
||||
// Not all browsers support upload events
|
||||
if (typeof config.onUploadProgress === 'function' && request.upload) {
|
||||
request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
|
||||
if (onUploadProgress && request.upload) {
|
||||
([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
|
||||
|
||||
request.upload.addEventListener('progress', uploadThrottled);
|
||||
|
||||
request.upload.addEventListener('loadend', flushUpload);
|
||||
}
|
||||
|
||||
if (config.cancelToken || config.signal) {
|
||||
if (_config.cancelToken || _config.signal) {
|
||||
// Handle cancellation
|
||||
// eslint-disable-next-line func-names
|
||||
onCanceled = cancel => {
|
||||
@@ -240,13 +177,13 @@ export default isXHRAdapterSupported && function (config) {
|
||||
request = null;
|
||||
};
|
||||
|
||||
config.cancelToken && config.cancelToken.subscribe(onCanceled);
|
||||
if (config.signal) {
|
||||
config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
|
||||
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
||||
if (_config.signal) {
|
||||
_config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
|
||||
}
|
||||
}
|
||||
|
||||
const protocol = parseProtocol(fullPath);
|
||||
const protocol = parseProtocol(_config.url);
|
||||
|
||||
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
||||
reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
|
||||
|
||||
14
node_modules/axios/lib/cancel/CancelToken.js
generated
vendored
14
node_modules/axios/lib/cancel/CancelToken.js
generated
vendored
@@ -102,6 +102,20 @@ class CancelToken {
|
||||
}
|
||||
}
|
||||
|
||||
toAbortSignal() {
|
||||
const controller = new AbortController();
|
||||
|
||||
const abort = (err) => {
|
||||
controller.abort(err);
|
||||
};
|
||||
|
||||
this.subscribe(abort);
|
||||
|
||||
controller.signal.unsubscribe = () => this.unsubscribe(abort);
|
||||
|
||||
return controller.signal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
||||
* cancels the `CancelToken`.
|
||||
|
||||
44
node_modules/axios/lib/core/Axios.js
generated
vendored
44
node_modules/axios/lib/core/Axios.js
generated
vendored
@@ -39,17 +39,23 @@ class Axios {
|
||||
try {
|
||||
return await this._request(configOrUrl, config);
|
||||
} catch (err) {
|
||||
const dummy = {}
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(dummy)
|
||||
} else {
|
||||
dummy.stack = new Error().stack;
|
||||
}
|
||||
// slice off the Error: ... line
|
||||
dummy.stack = dummy.stack.replace(/^.+\n/, '');
|
||||
// match without the 2 top stack lines
|
||||
if (!err.stack.endsWith(dummy.stack.replace(/^.+\n.+\n/, ''))) {
|
||||
err.stack += '\n' + dummy.stack
|
||||
if (err instanceof Error) {
|
||||
let dummy = {};
|
||||
|
||||
Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
|
||||
|
||||
// slice off the Error: ... line
|
||||
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
|
||||
try {
|
||||
if (!err.stack) {
|
||||
err.stack = stack;
|
||||
// match without the 2 top stack lines
|
||||
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
|
||||
err.stack += '\n' + stack
|
||||
}
|
||||
} catch (e) {
|
||||
// ignore the case where "stack" is an un-writable property
|
||||
}
|
||||
}
|
||||
|
||||
throw err;
|
||||
@@ -91,6 +97,20 @@ class Axios {
|
||||
}
|
||||
}
|
||||
|
||||
// Set config.allowAbsoluteUrls
|
||||
if (config.allowAbsoluteUrls !== undefined) {
|
||||
// do nothing
|
||||
} else if (this.defaults.allowAbsoluteUrls !== undefined) {
|
||||
config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
|
||||
} else {
|
||||
config.allowAbsoluteUrls = true;
|
||||
}
|
||||
|
||||
validator.assertOptions(config, {
|
||||
baseUrl: validators.spelling('baseURL'),
|
||||
withXsrfToken: validators.spelling('withXSRFToken')
|
||||
}, true);
|
||||
|
||||
// Set config.method
|
||||
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
||||
|
||||
@@ -181,7 +201,7 @@ class Axios {
|
||||
|
||||
getUri(config) {
|
||||
config = mergeConfig(this.defaults, config);
|
||||
const fullPath = buildFullPath(config.baseURL, config.url);
|
||||
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
|
||||
return buildURL(fullPath, config.params, config.paramsSerializer);
|
||||
}
|
||||
}
|
||||
|
||||
7
node_modules/axios/lib/core/AxiosError.js
generated
vendored
7
node_modules/axios/lib/core/AxiosError.js
generated
vendored
@@ -27,7 +27,10 @@ function AxiosError(message, code, config, request, response) {
|
||||
code && (this.code = code);
|
||||
config && (this.config = config);
|
||||
request && (this.request = request);
|
||||
response && (this.response = response);
|
||||
if (response) {
|
||||
this.response = response;
|
||||
this.status = response.status ? response.status : null;
|
||||
}
|
||||
}
|
||||
|
||||
utils.inherits(AxiosError, Error, {
|
||||
@@ -47,7 +50,7 @@ utils.inherits(AxiosError, Error, {
|
||||
// Axios
|
||||
config: utils.toJSONObject(this.config),
|
||||
code: this.code,
|
||||
status: this.response && this.response.status ? this.response.status : null
|
||||
status: this.status
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
4
node_modules/axios/lib/core/AxiosHeaders.js
generated
vendored
4
node_modules/axios/lib/core/AxiosHeaders.js
generated
vendored
@@ -100,6 +100,10 @@ class AxiosHeaders {
|
||||
setHeaders(header, valueOrRewrite)
|
||||
} else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
||||
setHeaders(parseHeaders(header), valueOrRewrite);
|
||||
} else if (utils.isHeaders(header)) {
|
||||
for (const [key, value] of header.entries()) {
|
||||
setHeader(value, key, rewrite);
|
||||
}
|
||||
} else {
|
||||
header != null && setHeader(valueOrRewrite, header, rewrite);
|
||||
}
|
||||
|
||||
5
node_modules/axios/lib/core/buildFullPath.js
generated
vendored
5
node_modules/axios/lib/core/buildFullPath.js
generated
vendored
@@ -13,8 +13,9 @@ import combineURLs from '../helpers/combineURLs.js';
|
||||
*
|
||||
* @returns {string} The combined full path
|
||||
*/
|
||||
export default function buildFullPath(baseURL, requestedURL) {
|
||||
if (baseURL && !isAbsoluteURL(requestedURL)) {
|
||||
export default function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
||||
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
||||
if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
|
||||
return combineURLs(baseURL, requestedURL);
|
||||
}
|
||||
return requestedURL;
|
||||
|
||||
12
node_modules/axios/lib/core/mergeConfig.js
generated
vendored
12
node_modules/axios/lib/core/mergeConfig.js
generated
vendored
@@ -3,7 +3,7 @@
|
||||
import utils from '../utils.js';
|
||||
import AxiosHeaders from "./AxiosHeaders.js";
|
||||
|
||||
const headersToObject = (thing) => thing instanceof AxiosHeaders ? thing.toJSON() : thing;
|
||||
const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;
|
||||
|
||||
/**
|
||||
* Config-specific merge-function which creates a new config-object
|
||||
@@ -19,7 +19,7 @@ export default function mergeConfig(config1, config2) {
|
||||
config2 = config2 || {};
|
||||
const config = {};
|
||||
|
||||
function getMergedValue(target, source, caseless) {
|
||||
function getMergedValue(target, source, prop, caseless) {
|
||||
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
||||
return utils.merge.call({caseless}, target, source);
|
||||
} else if (utils.isPlainObject(source)) {
|
||||
@@ -31,11 +31,11 @@ export default function mergeConfig(config1, config2) {
|
||||
}
|
||||
|
||||
// eslint-disable-next-line consistent-return
|
||||
function mergeDeepProperties(a, b, caseless) {
|
||||
function mergeDeepProperties(a, b, prop , caseless) {
|
||||
if (!utils.isUndefined(b)) {
|
||||
return getMergedValue(a, b, caseless);
|
||||
return getMergedValue(a, b, prop , caseless);
|
||||
} else if (!utils.isUndefined(a)) {
|
||||
return getMergedValue(undefined, a, caseless);
|
||||
return getMergedValue(undefined, a, prop , caseless);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ export default function mergeConfig(config1, config2) {
|
||||
socketPath: defaultToConfig2,
|
||||
responseEncoding: defaultToConfig2,
|
||||
validateStatus: mergeDirectKeys,
|
||||
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
||||
headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
|
||||
};
|
||||
|
||||
utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
||||
|
||||
12
node_modules/axios/lib/defaults/index.js
generated
vendored
12
node_modules/axios/lib/defaults/index.js
generated
vendored
@@ -37,7 +37,7 @@ const defaults = {
|
||||
|
||||
transitional: transitionalDefaults,
|
||||
|
||||
adapter: ['xhr', 'http'],
|
||||
adapter: ['xhr', 'http', 'fetch'],
|
||||
|
||||
transformRequest: [function transformRequest(data, headers) {
|
||||
const contentType = headers.getContentType() || '';
|
||||
@@ -51,9 +51,6 @@ const defaults = {
|
||||
const isFormData = utils.isFormData(data);
|
||||
|
||||
if (isFormData) {
|
||||
if (!hasJSONContentType) {
|
||||
return data;
|
||||
}
|
||||
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
||||
}
|
||||
|
||||
@@ -61,7 +58,8 @@ const defaults = {
|
||||
utils.isBuffer(data) ||
|
||||
utils.isStream(data) ||
|
||||
utils.isFile(data) ||
|
||||
utils.isBlob(data)
|
||||
utils.isBlob(data) ||
|
||||
utils.isReadableStream(data)
|
||||
) {
|
||||
return data;
|
||||
}
|
||||
@@ -104,6 +102,10 @@ const defaults = {
|
||||
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
||||
const JSONRequested = this.responseType === 'json';
|
||||
|
||||
if (utils.isResponse(data) || utils.isReadableStream(data)) {
|
||||
return data;
|
||||
}
|
||||
|
||||
if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
||||
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
||||
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
||||
|
||||
2
node_modules/axios/lib/env/data.js
generated
vendored
2
node_modules/axios/lib/env/data.js
generated
vendored
@@ -1 +1 @@
|
||||
export const VERSION = "1.6.6";
|
||||
export const VERSION = "1.8.4";
|
||||
54
node_modules/axios/lib/helpers/AxiosTransformStream.js
generated
vendored
54
node_modules/axios/lib/helpers/AxiosTransformStream.js
generated
vendored
@@ -2,8 +2,6 @@
|
||||
|
||||
import stream from 'stream';
|
||||
import utils from '../utils.js';
|
||||
import throttle from './throttle.js';
|
||||
import speedometer from './speedometer.js';
|
||||
|
||||
const kInternals = Symbol('internals');
|
||||
|
||||
@@ -24,12 +22,8 @@ class AxiosTransformStream extends stream.Transform{
|
||||
readableHighWaterMark: options.chunkSize
|
||||
});
|
||||
|
||||
const self = this;
|
||||
|
||||
const internals = this[kInternals] = {
|
||||
length: options.length,
|
||||
timeWindow: options.timeWindow,
|
||||
ticksRate: options.ticksRate,
|
||||
chunkSize: options.chunkSize,
|
||||
maxRate: options.maxRate,
|
||||
minChunkSize: options.minChunkSize,
|
||||
@@ -41,8 +35,6 @@ class AxiosTransformStream extends stream.Transform{
|
||||
onReadCallback: null
|
||||
};
|
||||
|
||||
const _speedometer = speedometer(internals.ticksRate * options.samplesCount, internals.timeWindow);
|
||||
|
||||
this.on('newListener', event => {
|
||||
if (event === 'progress') {
|
||||
if (!internals.isCaptured) {
|
||||
@@ -50,38 +42,6 @@ class AxiosTransformStream extends stream.Transform{
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let bytesNotified = 0;
|
||||
|
||||
internals.updateProgress = throttle(function throttledHandler() {
|
||||
const totalBytes = internals.length;
|
||||
const bytesTransferred = internals.bytesSeen;
|
||||
const progressBytes = bytesTransferred - bytesNotified;
|
||||
if (!progressBytes || self.destroyed) return;
|
||||
|
||||
const rate = _speedometer(progressBytes);
|
||||
|
||||
bytesNotified = bytesTransferred;
|
||||
|
||||
process.nextTick(() => {
|
||||
self.emit('progress', {
|
||||
'loaded': bytesTransferred,
|
||||
'total': totalBytes,
|
||||
'progress': totalBytes ? (bytesTransferred / totalBytes) : undefined,
|
||||
'bytes': progressBytes,
|
||||
'rate': rate ? rate : undefined,
|
||||
'estimated': rate && totalBytes && bytesTransferred <= totalBytes ?
|
||||
(totalBytes - bytesTransferred) / rate : undefined
|
||||
});
|
||||
});
|
||||
}, internals.ticksRate);
|
||||
|
||||
const onFinish = () => {
|
||||
internals.updateProgress(true);
|
||||
};
|
||||
|
||||
this.once('end', onFinish);
|
||||
this.once('error', onFinish);
|
||||
}
|
||||
|
||||
_read(size) {
|
||||
@@ -95,7 +55,6 @@ class AxiosTransformStream extends stream.Transform{
|
||||
}
|
||||
|
||||
_transform(chunk, encoding, callback) {
|
||||
const self = this;
|
||||
const internals = this[kInternals];
|
||||
const maxRate = internals.maxRate;
|
||||
|
||||
@@ -107,16 +66,14 @@ class AxiosTransformStream extends stream.Transform{
|
||||
const bytesThreshold = (maxRate / divider);
|
||||
const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
|
||||
|
||||
function pushChunk(_chunk, _callback) {
|
||||
const pushChunk = (_chunk, _callback) => {
|
||||
const bytes = Buffer.byteLength(_chunk);
|
||||
internals.bytesSeen += bytes;
|
||||
internals.bytes += bytes;
|
||||
|
||||
if (internals.isCaptured) {
|
||||
internals.updateProgress();
|
||||
}
|
||||
internals.isCaptured && this.emit('progress', internals.bytesSeen);
|
||||
|
||||
if (self.push(_chunk)) {
|
||||
if (this.push(_chunk)) {
|
||||
process.nextTick(_callback);
|
||||
} else {
|
||||
internals.onReadCallback = () => {
|
||||
@@ -181,11 +138,6 @@ class AxiosTransformStream extends stream.Transform{
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setLength(length) {
|
||||
this[kInternals].length = +length;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
export default AxiosTransformStream;
|
||||
|
||||
8
node_modules/axios/lib/helpers/buildURL.js
generated
vendored
8
node_modules/axios/lib/helpers/buildURL.js
generated
vendored
@@ -26,7 +26,7 @@ function encode(val) {
|
||||
*
|
||||
* @param {string} url The base of the url (e.g., http://www.google.com)
|
||||
* @param {object} [params] The params to be appended
|
||||
* @param {?object} options
|
||||
* @param {?(object|Function)} options
|
||||
*
|
||||
* @returns {string} The formatted url
|
||||
*/
|
||||
@@ -38,6 +38,12 @@ export default function buildURL(url, params, options) {
|
||||
|
||||
const _encode = options && options.encode || encode;
|
||||
|
||||
if (utils.isFunction(options)) {
|
||||
options = {
|
||||
serialize: options
|
||||
};
|
||||
}
|
||||
|
||||
const serializeFn = options && options.serialize;
|
||||
|
||||
let serializedParams;
|
||||
|
||||
48
node_modules/axios/lib/helpers/composeSignals.js
generated
vendored
Normal file
48
node_modules/axios/lib/helpers/composeSignals.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
import CanceledError from "../cancel/CanceledError.js";
|
||||
import AxiosError from "../core/AxiosError.js";
|
||||
import utils from '../utils.js';
|
||||
|
||||
const composeSignals = (signals, timeout) => {
|
||||
const {length} = (signals = signals ? signals.filter(Boolean) : []);
|
||||
|
||||
if (timeout || length) {
|
||||
let controller = new AbortController();
|
||||
|
||||
let aborted;
|
||||
|
||||
const onabort = function (reason) {
|
||||
if (!aborted) {
|
||||
aborted = true;
|
||||
unsubscribe();
|
||||
const err = reason instanceof Error ? reason : this.reason;
|
||||
controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
|
||||
}
|
||||
}
|
||||
|
||||
let timer = timeout && setTimeout(() => {
|
||||
timer = null;
|
||||
onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT))
|
||||
}, timeout)
|
||||
|
||||
const unsubscribe = () => {
|
||||
if (signals) {
|
||||
timer && clearTimeout(timer);
|
||||
timer = null;
|
||||
signals.forEach(signal => {
|
||||
signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
|
||||
});
|
||||
signals = null;
|
||||
}
|
||||
}
|
||||
|
||||
signals.forEach((signal) => signal.addEventListener('abort', onabort));
|
||||
|
||||
const {signal} = controller;
|
||||
|
||||
signal.unsubscribe = () => utils.asap(unsubscribe);
|
||||
|
||||
return signal;
|
||||
}
|
||||
}
|
||||
|
||||
export default composeSignals;
|
||||
9
node_modules/axios/lib/helpers/formDataToStream.js
generated
vendored
9
node_modules/axios/lib/helpers/formDataToStream.js
generated
vendored
@@ -1,11 +1,12 @@
|
||||
import {TextEncoder} from 'util';
|
||||
import util from 'util';
|
||||
import {Readable} from 'stream';
|
||||
import utils from "../utils.js";
|
||||
import readBlob from "./readBlob.js";
|
||||
import platform from "../platform/index.js";
|
||||
|
||||
const BOUNDARY_ALPHABET = utils.ALPHABET.ALPHA_DIGIT + '-_';
|
||||
const BOUNDARY_ALPHABET = platform.ALPHABET.ALPHA_DIGIT + '-_';
|
||||
|
||||
const textEncoder = new TextEncoder();
|
||||
const textEncoder = typeof TextEncoder === 'function' ? new TextEncoder() : new util.TextEncoder();
|
||||
|
||||
const CRLF = '\r\n';
|
||||
const CRLF_BYTES = textEncoder.encode(CRLF);
|
||||
@@ -63,7 +64,7 @@ const formDataToStream = (form, headersHandler, options) => {
|
||||
const {
|
||||
tag = 'form-data-boundary',
|
||||
size = 25,
|
||||
boundary = tag + '-' + utils.generateString(size, BOUNDARY_ALPHABET)
|
||||
boundary = tag + '-' + platform.generateString(size, BOUNDARY_ALPHABET)
|
||||
} = options || {};
|
||||
|
||||
if(!utils.isFormData(form)) {
|
||||
|
||||
75
node_modules/axios/lib/helpers/isURLSameOrigin.js
generated
vendored
75
node_modules/axios/lib/helpers/isURLSameOrigin.js
generated
vendored
@@ -1,67 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
import utils from './../utils.js';
|
||||
import platform from '../platform/index.js';
|
||||
|
||||
export default platform.hasStandardBrowserEnv ?
|
||||
export default platform.hasStandardBrowserEnv ? ((origin, isMSIE) => (url) => {
|
||||
url = new URL(url, platform.origin);
|
||||
|
||||
// Standard browser envs have full support of the APIs needed to test
|
||||
// whether the request URL is of the same origin as current location.
|
||||
(function standardBrowserEnv() {
|
||||
const msie = /(msie|trident)/i.test(navigator.userAgent);
|
||||
const urlParsingNode = document.createElement('a');
|
||||
let originURL;
|
||||
|
||||
/**
|
||||
* Parse a URL to discover its components
|
||||
*
|
||||
* @param {String} url The URL to be parsed
|
||||
* @returns {Object}
|
||||
*/
|
||||
function resolveURL(url) {
|
||||
let href = url;
|
||||
|
||||
if (msie) {
|
||||
// IE needs attribute set twice to normalize properties
|
||||
urlParsingNode.setAttribute('href', href);
|
||||
href = urlParsingNode.href;
|
||||
}
|
||||
|
||||
urlParsingNode.setAttribute('href', href);
|
||||
|
||||
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
|
||||
return {
|
||||
href: urlParsingNode.href,
|
||||
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
|
||||
host: urlParsingNode.host,
|
||||
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
|
||||
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
|
||||
hostname: urlParsingNode.hostname,
|
||||
port: urlParsingNode.port,
|
||||
pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
|
||||
urlParsingNode.pathname :
|
||||
'/' + urlParsingNode.pathname
|
||||
};
|
||||
}
|
||||
|
||||
originURL = resolveURL(window.location.href);
|
||||
|
||||
/**
|
||||
* Determine if a URL shares the same origin as the current location
|
||||
*
|
||||
* @param {String} requestURL The URL to test
|
||||
* @returns {boolean} True if URL shares the same origin, otherwise false
|
||||
*/
|
||||
return function isURLSameOrigin(requestURL) {
|
||||
const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
|
||||
return (parsed.protocol === originURL.protocol &&
|
||||
parsed.host === originURL.host);
|
||||
};
|
||||
})() :
|
||||
|
||||
// Non standard browser envs (web workers, react-native) lack needed support.
|
||||
(function nonStandardBrowserEnv() {
|
||||
return function isURLSameOrigin() {
|
||||
return true;
|
||||
};
|
||||
})();
|
||||
return (
|
||||
origin.protocol === url.protocol &&
|
||||
origin.host === url.host &&
|
||||
(isMSIE || origin.port === url.port)
|
||||
);
|
||||
})(
|
||||
new URL(platform.origin),
|
||||
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
||||
) : () => true;
|
||||
|
||||
44
node_modules/axios/lib/helpers/progressEventReducer.js
generated
vendored
Normal file
44
node_modules/axios/lib/helpers/progressEventReducer.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
import speedometer from "./speedometer.js";
|
||||
import throttle from "./throttle.js";
|
||||
import utils from "../utils.js";
|
||||
|
||||
export const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
||||
let bytesNotified = 0;
|
||||
const _speedometer = speedometer(50, 250);
|
||||
|
||||
return throttle(e => {
|
||||
const loaded = e.loaded;
|
||||
const total = e.lengthComputable ? e.total : undefined;
|
||||
const progressBytes = loaded - bytesNotified;
|
||||
const rate = _speedometer(progressBytes);
|
||||
const inRange = loaded <= total;
|
||||
|
||||
bytesNotified = loaded;
|
||||
|
||||
const data = {
|
||||
loaded,
|
||||
total,
|
||||
progress: total ? (loaded / total) : undefined,
|
||||
bytes: progressBytes,
|
||||
rate: rate ? rate : undefined,
|
||||
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
||||
event: e,
|
||||
lengthComputable: total != null,
|
||||
[isDownloadStream ? 'download' : 'upload']: true
|
||||
};
|
||||
|
||||
listener(data);
|
||||
}, freq);
|
||||
}
|
||||
|
||||
export const progressEventDecorator = (total, throttled) => {
|
||||
const lengthComputable = total != null;
|
||||
|
||||
return [(loaded) => throttled[0]({
|
||||
lengthComputable,
|
||||
total,
|
||||
loaded
|
||||
}), throttled[1]];
|
||||
}
|
||||
|
||||
export const asyncDecorator = (fn) => (...args) => utils.asap(() => fn(...args));
|
||||
57
node_modules/axios/lib/helpers/resolveConfig.js
generated
vendored
Normal file
57
node_modules/axios/lib/helpers/resolveConfig.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
import platform from "../platform/index.js";
|
||||
import utils from "../utils.js";
|
||||
import isURLSameOrigin from "./isURLSameOrigin.js";
|
||||
import cookies from "./cookies.js";
|
||||
import buildFullPath from "../core/buildFullPath.js";
|
||||
import mergeConfig from "../core/mergeConfig.js";
|
||||
import AxiosHeaders from "../core/AxiosHeaders.js";
|
||||
import buildURL from "./buildURL.js";
|
||||
|
||||
export default (config) => {
|
||||
const newConfig = mergeConfig({}, config);
|
||||
|
||||
let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
|
||||
|
||||
newConfig.headers = headers = AxiosHeaders.from(headers);
|
||||
|
||||
newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
|
||||
|
||||
// HTTP basic authentication
|
||||
if (auth) {
|
||||
headers.set('Authorization', 'Basic ' +
|
||||
btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))
|
||||
);
|
||||
}
|
||||
|
||||
let contentType;
|
||||
|
||||
if (utils.isFormData(data)) {
|
||||
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
||||
headers.setContentType(undefined); // Let the browser set it
|
||||
} else if ((contentType = headers.getContentType()) !== false) {
|
||||
// fix semicolon duplication issue for ReactNative FormData implementation
|
||||
const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
|
||||
headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
|
||||
}
|
||||
}
|
||||
|
||||
// Add xsrf header
|
||||
// This is only done if running in a standard browser environment.
|
||||
// Specifically not if we're in a web worker, or react-native.
|
||||
|
||||
if (platform.hasStandardBrowserEnv) {
|
||||
withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
|
||||
|
||||
if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
|
||||
// Add xsrf header
|
||||
const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
|
||||
|
||||
if (xsrfValue) {
|
||||
headers.set(xsrfHeaderName, xsrfValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return newConfig;
|
||||
}
|
||||
|
||||
49
node_modules/axios/lib/helpers/throttle.js
generated
vendored
49
node_modules/axios/lib/helpers/throttle.js
generated
vendored
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Throttle decorator
|
||||
* @param {Function} fn
|
||||
@@ -8,26 +6,39 @@
|
||||
*/
|
||||
function throttle(fn, freq) {
|
||||
let timestamp = 0;
|
||||
const threshold = 1000 / freq;
|
||||
let timer = null;
|
||||
return function throttled(force, args) {
|
||||
let threshold = 1000 / freq;
|
||||
let lastArgs;
|
||||
let timer;
|
||||
|
||||
const invoke = (args, now = Date.now()) => {
|
||||
timestamp = now;
|
||||
lastArgs = null;
|
||||
if (timer) {
|
||||
clearTimeout(timer);
|
||||
timer = null;
|
||||
}
|
||||
fn.apply(null, args);
|
||||
}
|
||||
|
||||
const throttled = (...args) => {
|
||||
const now = Date.now();
|
||||
if (force || now - timestamp > threshold) {
|
||||
if (timer) {
|
||||
clearTimeout(timer);
|
||||
timer = null;
|
||||
const passed = now - timestamp;
|
||||
if ( passed >= threshold) {
|
||||
invoke(args, now);
|
||||
} else {
|
||||
lastArgs = args;
|
||||
if (!timer) {
|
||||
timer = setTimeout(() => {
|
||||
timer = null;
|
||||
invoke(lastArgs)
|
||||
}, threshold - passed);
|
||||
}
|
||||
timestamp = now;
|
||||
return fn.apply(null, args);
|
||||
}
|
||||
if (!timer) {
|
||||
timer = setTimeout(() => {
|
||||
timer = null;
|
||||
timestamp = Date.now();
|
||||
return fn.apply(null, args);
|
||||
}, threshold - (now - timestamp));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const flush = () => lastArgs && invoke(lastArgs);
|
||||
|
||||
return [throttled, flush];
|
||||
}
|
||||
|
||||
export default throttle;
|
||||
|
||||
87
node_modules/axios/lib/helpers/trackStream.js
generated
vendored
Normal file
87
node_modules/axios/lib/helpers/trackStream.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
|
||||
export const streamChunk = function* (chunk, chunkSize) {
|
||||
let len = chunk.byteLength;
|
||||
|
||||
if (!chunkSize || len < chunkSize) {
|
||||
yield chunk;
|
||||
return;
|
||||
}
|
||||
|
||||
let pos = 0;
|
||||
let end;
|
||||
|
||||
while (pos < len) {
|
||||
end = pos + chunkSize;
|
||||
yield chunk.slice(pos, end);
|
||||
pos = end;
|
||||
}
|
||||
}
|
||||
|
||||
export const readBytes = async function* (iterable, chunkSize) {
|
||||
for await (const chunk of readStream(iterable)) {
|
||||
yield* streamChunk(chunk, chunkSize);
|
||||
}
|
||||
}
|
||||
|
||||
const readStream = async function* (stream) {
|
||||
if (stream[Symbol.asyncIterator]) {
|
||||
yield* stream;
|
||||
return;
|
||||
}
|
||||
|
||||
const reader = stream.getReader();
|
||||
try {
|
||||
for (;;) {
|
||||
const {done, value} = await reader.read();
|
||||
if (done) {
|
||||
break;
|
||||
}
|
||||
yield value;
|
||||
}
|
||||
} finally {
|
||||
await reader.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
export const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
||||
const iterator = readBytes(stream, chunkSize);
|
||||
|
||||
let bytes = 0;
|
||||
let done;
|
||||
let _onFinish = (e) => {
|
||||
if (!done) {
|
||||
done = true;
|
||||
onFinish && onFinish(e);
|
||||
}
|
||||
}
|
||||
|
||||
return new ReadableStream({
|
||||
async pull(controller) {
|
||||
try {
|
||||
const {done, value} = await iterator.next();
|
||||
|
||||
if (done) {
|
||||
_onFinish();
|
||||
controller.close();
|
||||
return;
|
||||
}
|
||||
|
||||
let len = value.byteLength;
|
||||
if (onProgress) {
|
||||
let loadedBytes = bytes += len;
|
||||
onProgress(loadedBytes);
|
||||
}
|
||||
controller.enqueue(new Uint8Array(value));
|
||||
} catch (err) {
|
||||
_onFinish(err);
|
||||
throw err;
|
||||
}
|
||||
},
|
||||
cancel(reason) {
|
||||
_onFinish(reason);
|
||||
return iterator.return();
|
||||
}
|
||||
}, {
|
||||
highWaterMark: 2
|
||||
})
|
||||
}
|
||||
8
node_modules/axios/lib/helpers/validator.js
generated
vendored
8
node_modules/axios/lib/helpers/validator.js
generated
vendored
@@ -52,6 +52,14 @@ validators.transitional = function transitional(validator, version, message) {
|
||||
};
|
||||
};
|
||||
|
||||
validators.spelling = function spelling(correctSpelling) {
|
||||
return (value, opt) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Assert object's properties type
|
||||
*
|
||||
|
||||
14
node_modules/axios/lib/platform/common/utils.js
generated
vendored
14
node_modules/axios/lib/platform/common/utils.js
generated
vendored
@@ -1,5 +1,7 @@
|
||||
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
||||
|
||||
const _navigator = typeof navigator === 'object' && navigator || undefined;
|
||||
|
||||
/**
|
||||
* Determine if we're running in a standard browser environment
|
||||
*
|
||||
@@ -17,10 +19,8 @@ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'unde
|
||||
*
|
||||
* @returns {boolean}
|
||||
*/
|
||||
const hasStandardBrowserEnv = (
|
||||
(product) => {
|
||||
return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
|
||||
})(typeof navigator !== 'undefined' && navigator.product);
|
||||
const hasStandardBrowserEnv = hasBrowserEnv &&
|
||||
(!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
|
||||
|
||||
/**
|
||||
* Determine if we're running in a standard browser webWorker environment
|
||||
@@ -40,8 +40,12 @@ const hasStandardBrowserWebWorkerEnv = (() => {
|
||||
);
|
||||
})();
|
||||
|
||||
const origin = hasBrowserEnv && window.location.href || 'http://localhost';
|
||||
|
||||
export {
|
||||
hasBrowserEnv,
|
||||
hasStandardBrowserWebWorkerEnv,
|
||||
hasStandardBrowserEnv
|
||||
hasStandardBrowserEnv,
|
||||
_navigator as navigator,
|
||||
origin
|
||||
}
|
||||
|
||||
26
node_modules/axios/lib/platform/node/index.js
generated
vendored
26
node_modules/axios/lib/platform/node/index.js
generated
vendored
@@ -1,6 +1,30 @@
|
||||
import crypto from 'crypto';
|
||||
import URLSearchParams from './classes/URLSearchParams.js'
|
||||
import FormData from './classes/FormData.js'
|
||||
|
||||
const ALPHA = 'abcdefghijklmnopqrstuvwxyz'
|
||||
|
||||
const DIGIT = '0123456789';
|
||||
|
||||
const ALPHABET = {
|
||||
DIGIT,
|
||||
ALPHA,
|
||||
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
|
||||
}
|
||||
|
||||
const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
||||
let str = '';
|
||||
const {length} = alphabet;
|
||||
const randomValues = new Uint32Array(size);
|
||||
crypto.randomFillSync(randomValues);
|
||||
for (let i = 0; i < size; i++) {
|
||||
str += alphabet[randomValues[i] % length];
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
export default {
|
||||
isNode: true,
|
||||
classes: {
|
||||
@@ -8,5 +32,7 @@ export default {
|
||||
FormData,
|
||||
Blob: typeof Blob !== 'undefined' && Blob || null
|
||||
},
|
||||
ALPHABET,
|
||||
generateString,
|
||||
protocols: [ 'http', 'https', 'file', 'data' ]
|
||||
};
|
||||
|
||||
65
node_modules/axios/lib/utils.js
generated
vendored
65
node_modules/axios/lib/utils.js
generated
vendored
@@ -209,6 +209,8 @@ const isFormData = (thing) => {
|
||||
*/
|
||||
const isURLSearchParams = kindOfTest('URLSearchParams');
|
||||
|
||||
const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);
|
||||
|
||||
/**
|
||||
* Trim excess whitespace off the beginning and end of a string
|
||||
*
|
||||
@@ -597,28 +599,7 @@ const toObjectSet = (arrayOrString, delimiter) => {
|
||||
const noop = () => {}
|
||||
|
||||
const toFiniteNumber = (value, defaultValue) => {
|
||||
value = +value;
|
||||
return Number.isFinite(value) ? value : defaultValue;
|
||||
}
|
||||
|
||||
const ALPHA = 'abcdefghijklmnopqrstuvwxyz'
|
||||
|
||||
const DIGIT = '0123456789';
|
||||
|
||||
const ALPHABET = {
|
||||
DIGIT,
|
||||
ALPHA,
|
||||
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
|
||||
}
|
||||
|
||||
const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
||||
let str = '';
|
||||
const {length} = alphabet;
|
||||
while (size--) {
|
||||
str += alphabet[Math.random() * length|0]
|
||||
}
|
||||
|
||||
return str;
|
||||
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -668,6 +649,36 @@ const isAsyncFn = kindOfTest('AsyncFunction');
|
||||
const isThenable = (thing) =>
|
||||
thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
|
||||
|
||||
// original code
|
||||
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
||||
|
||||
const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
||||
if (setImmediateSupported) {
|
||||
return setImmediate;
|
||||
}
|
||||
|
||||
return postMessageSupported ? ((token, callbacks) => {
|
||||
_global.addEventListener("message", ({source, data}) => {
|
||||
if (source === _global && data === token) {
|
||||
callbacks.length && callbacks.shift()();
|
||||
}
|
||||
}, false);
|
||||
|
||||
return (cb) => {
|
||||
callbacks.push(cb);
|
||||
_global.postMessage(token, "*");
|
||||
}
|
||||
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
|
||||
})(
|
||||
typeof setImmediate === 'function',
|
||||
isFunction(_global.postMessage)
|
||||
);
|
||||
|
||||
const asap = typeof queueMicrotask !== 'undefined' ?
|
||||
queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate);
|
||||
|
||||
// *********************
|
||||
|
||||
export default {
|
||||
isArray,
|
||||
isArrayBuffer,
|
||||
@@ -679,6 +690,10 @@ export default {
|
||||
isBoolean,
|
||||
isObject,
|
||||
isPlainObject,
|
||||
isReadableStream,
|
||||
isRequest,
|
||||
isResponse,
|
||||
isHeaders,
|
||||
isUndefined,
|
||||
isDate,
|
||||
isFile,
|
||||
@@ -714,10 +729,10 @@ export default {
|
||||
findKey,
|
||||
global: _global,
|
||||
isContextDefined,
|
||||
ALPHABET,
|
||||
generateString,
|
||||
isSpecCompliantForm,
|
||||
toJSONObject,
|
||||
isAsyncFn,
|
||||
isThenable
|
||||
isThenable,
|
||||
setImmediate: _setImmediate,
|
||||
asap
|
||||
};
|
||||
|
||||
59
node_modules/axios/package.json
generated
vendored
59
node_modules/axios/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "axios",
|
||||
"version": "1.6.6",
|
||||
"version": "1.8.4",
|
||||
"description": "Promise based HTTP client for the browser and node.js",
|
||||
"main": "index.js",
|
||||
"exports": {
|
||||
@@ -80,41 +80,41 @@
|
||||
},
|
||||
"homepage": "https://axios-http.com",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.18.2",
|
||||
"@babel/preset-env": "^7.18.2",
|
||||
"@commitlint/cli": "^17.3.0",
|
||||
"@commitlint/config-conventional": "^17.3.0",
|
||||
"@babel/core": "^7.23.9",
|
||||
"@babel/preset-env": "^7.23.9",
|
||||
"@commitlint/cli": "^17.8.1",
|
||||
"@commitlint/config-conventional": "^17.8.1",
|
||||
"@release-it/conventional-changelog": "^5.1.1",
|
||||
"@rollup/plugin-babel": "^5.3.1",
|
||||
"@rollup/plugin-commonjs": "^15.1.0",
|
||||
"@rollup/plugin-json": "^4.1.0",
|
||||
"@rollup/plugin-multi-entry": "^4.0.0",
|
||||
"@rollup/plugin-multi-entry": "^4.1.0",
|
||||
"@rollup/plugin-node-resolve": "^9.0.0",
|
||||
"abortcontroller-polyfill": "^1.7.3",
|
||||
"abortcontroller-polyfill": "^1.7.5",
|
||||
"auto-changelog": "^2.4.0",
|
||||
"body-parser": "^1.20.0",
|
||||
"chalk": "^5.2.0",
|
||||
"body-parser": "^1.20.2",
|
||||
"chalk": "^5.3.0",
|
||||
"coveralls": "^3.1.1",
|
||||
"cross-env": "^7.0.3",
|
||||
"dev-null": "^0.1.1",
|
||||
"dtslint": "^4.2.1",
|
||||
"es6-promise": "^4.2.8",
|
||||
"eslint": "^8.17.0",
|
||||
"express": "^4.18.1",
|
||||
"formdata-node": "^5.0.0",
|
||||
"formidable": "^2.0.1",
|
||||
"eslint": "^8.56.0",
|
||||
"express": "^4.18.2",
|
||||
"formdata-node": "^5.0.1",
|
||||
"formidable": "^2.1.2",
|
||||
"fs-extra": "^10.1.0",
|
||||
"get-stream": "^3.0.0",
|
||||
"gulp": "^4.0.2",
|
||||
"gzip-size": "^7.0.0",
|
||||
"handlebars": "^4.7.7",
|
||||
"husky": "^8.0.2",
|
||||
"handlebars": "^4.7.8",
|
||||
"husky": "^8.0.3",
|
||||
"istanbul-instrumenter-loader": "^3.0.1",
|
||||
"jasmine-core": "^2.4.1",
|
||||
"jasmine-core": "^2.99.1",
|
||||
"karma": "^6.3.17",
|
||||
"karma-chrome-launcher": "^3.1.1",
|
||||
"karma-chrome-launcher": "^3.2.0",
|
||||
"karma-firefox-launcher": "^2.1.2",
|
||||
"karma-jasmine": "^1.1.1",
|
||||
"karma-jasmine": "^1.1.2",
|
||||
"karma-jasmine-ajax": "^0.1.13",
|
||||
"karma-rollup-preprocessor": "^7.0.8",
|
||||
"karma-safari-launcher": "^1.0.0",
|
||||
@@ -122,12 +122,12 @@
|
||||
"karma-sinon": "^1.0.5",
|
||||
"karma-sourcemap-loader": "^0.3.8",
|
||||
"memoizee": "^0.4.15",
|
||||
"minimist": "^1.2.7",
|
||||
"mocha": "^10.0.0",
|
||||
"minimist": "^1.2.8",
|
||||
"mocha": "^10.3.0",
|
||||
"multer": "^1.4.4",
|
||||
"pretty-bytes": "^6.0.0",
|
||||
"release-it": "^15.5.1",
|
||||
"rollup": "^2.67.0",
|
||||
"pretty-bytes": "^6.1.1",
|
||||
"release-it": "^15.11.0",
|
||||
"rollup": "^2.79.1",
|
||||
"rollup-plugin-auto-external": "^2.0.0",
|
||||
"rollup-plugin-bundle-size": "^1.0.3",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
@@ -135,7 +135,8 @@
|
||||
"stream-throttle": "^0.1.3",
|
||||
"string-replace-async": "^3.0.2",
|
||||
"terser-webpack-plugin": "^4.2.3",
|
||||
"typescript": "^4.8.4"
|
||||
"typescript": "^4.9.5",
|
||||
"@rollup/plugin-alias": "^5.1.0"
|
||||
},
|
||||
"browser": {
|
||||
"./lib/adapters/http.js": "./lib/helpers/null.js",
|
||||
@@ -146,7 +147,7 @@
|
||||
"unpkg": "dist/axios.min.js",
|
||||
"typings": "./index.d.ts",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.15.4",
|
||||
"follow-redirects": "^1.15.6",
|
||||
"form-data": "^4.0.0",
|
||||
"proxy-from-env": "^1.1.0"
|
||||
},
|
||||
@@ -159,17 +160,17 @@
|
||||
"contributors": [
|
||||
"Matt Zabriskie (https://github.com/mzabriskie)",
|
||||
"Nick Uraltsev (https://github.com/nickuraltsev)",
|
||||
"Jay (https://github.com/jasonsaayman)",
|
||||
"Dmitriy Mozgovoy (https://github.com/DigitalBrainJS)",
|
||||
"Jay (https://github.com/jasonsaayman)",
|
||||
"Emily Morehouse (https://github.com/emilyemorehouse)",
|
||||
"Rubén Norte (https://github.com/rubennorte)",
|
||||
"Justin Beckwith (https://github.com/JustinBeckwith)",
|
||||
"Martti Laine (https://github.com/codeclown)",
|
||||
"Xianming Zhong (https://github.com/chinesedfan)",
|
||||
"Rikki Gibson (https://github.com/RikkiGibson)",
|
||||
"Remco Haszing (https://github.com/remcohaszing)",
|
||||
"Yasu Flores (https://github.com/yasuf)",
|
||||
"Ben Carp (https://github.com/carpben)"
|
||||
"Rikki Gibson (https://github.com/RikkiGibson)",
|
||||
"Ben Carp (https://github.com/carpben)",
|
||||
"Yasu Flores (https://github.com/yasuf)"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"release-it": {
|
||||
|
||||
Reference in New Issue
Block a user