mirror of
https://github.com/tenrok/axios.git
synced 2026-06-23 20:40:40 +03:00
feat: implement prettier and fix all issues (#7385)
* feat: implement prettier and fix all issues * fix: failing tests * fix: implement feedback from codel, ai etc * chore: dont throw in trim function Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> * fix: incorrect fix --------- Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
This commit is contained in:
+13
-12
@@ -1,15 +1,16 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
"env": {
|
env: {
|
||||||
"browser": true,
|
browser: true,
|
||||||
"es2018": true,
|
es2018: true,
|
||||||
"node": true
|
node: true,
|
||||||
},
|
},
|
||||||
"extends": "eslint:recommended",
|
extends: 'eslint:recommended',
|
||||||
"parserOptions": {
|
parserOptions: {
|
||||||
"ecmaVersion": 2018,
|
ecmaVersion: 2018,
|
||||||
"sourceType": "module"
|
sourceType: 'module',
|
||||||
},
|
},
|
||||||
"rules": {
|
rules: {
|
||||||
"no-cond-assign": 0
|
'no-cond-assign': 0,
|
||||||
}
|
'no-unused-vars': ['error', { args: 'none', varsIgnorePattern: '^_' }],
|
||||||
}
|
},
|
||||||
|
};
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# Dependencies
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# Build output
|
||||||
|
dist/
|
||||||
|
coverage/
|
||||||
|
|
||||||
|
# Lock files
|
||||||
|
package-lock.json
|
||||||
|
**/package-lock.json
|
||||||
|
|
||||||
|
# Generated / vendored
|
||||||
|
*.min.js
|
||||||
|
test/typescript/axios.js*
|
||||||
|
|
||||||
|
# Misc
|
||||||
|
*.iml
|
||||||
|
.idea
|
||||||
|
.DS_Store
|
||||||
|
sauce_connect.log
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"semi": true,
|
||||||
|
"singleQuote": true,
|
||||||
|
"tabWidth": 2,
|
||||||
|
"trailingComma": "es5",
|
||||||
|
"printWidth": 100
|
||||||
|
}
|
||||||
+206
-206
@@ -31,38 +31,38 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### Contributors to this release
|
||||||
|
|
||||||
- <img src="https://avatars.githubusercontent.com/u/175160345?v=4&s=18" alt="avatar" width="18"/> [Ashvin Tiwari](https://github.com/ashvin2005 "+1752/-4 (#7218 #7218 )")
|
- <img src="https://avatars.githubusercontent.com/u/175160345?v=4&s=18" alt="avatar" width="18"/> [Ashvin Tiwari](https://github.com/ashvin2005 '+1752/-4 (#7218 #7218 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/71729144?v=4&s=18" alt="avatar" width="18"/> [Nikunj Mochi](https://github.com/mochinikunj "+940/-12 (#7294 #7294 )")
|
- <img src="https://avatars.githubusercontent.com/u/71729144?v=4&s=18" alt="avatar" width="18"/> [Nikunj Mochi](https://github.com/mochinikunj '+940/-12 (#7294 #7294 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/128113546?v=4&s=18" alt="avatar" width="18"/> [Anchal Singh](https://github.com/imanchalsingh "+544/-102 (#7169 #7185 )")
|
- <img src="https://avatars.githubusercontent.com/u/128113546?v=4&s=18" alt="avatar" width="18"/> [Anchal Singh](https://github.com/imanchalsingh '+544/-102 (#7169 #7185 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/4814473?v=4&s=18" alt="avatar" width="18"/> [jasonsaayman](https://github.com/jasonsaayman "+317/-73 (#7334 #7298 )")
|
- <img src="https://avatars.githubusercontent.com/u/4814473?v=4&s=18" alt="avatar" width="18"/> [jasonsaayman](https://github.com/jasonsaayman '+317/-73 (#7334 #7298 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/377911?v=4&s=18" alt="avatar" width="18"/> [Julian Dax](https://github.com/brodo "+99/-120 (#5558 )")
|
- <img src="https://avatars.githubusercontent.com/u/377911?v=4&s=18" alt="avatar" width="18"/> [Julian Dax](https://github.com/brodo '+99/-120 (#5558 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/184285082?v=4&s=18" alt="avatar" width="18"/> [Akash Dhar Dubey](https://github.com/AKASHDHARDUBEY "+167/-0 (#7287 #7288 )")
|
- <img src="https://avatars.githubusercontent.com/u/184285082?v=4&s=18" alt="avatar" width="18"/> [Akash Dhar Dubey](https://github.com/AKASHDHARDUBEY '+167/-0 (#7287 #7288 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/145687605?v=4&s=18" alt="avatar" width="18"/> [Madhumita](https://github.com/madhumitaaa "+20/-68 (#7198 )")
|
- <img src="https://avatars.githubusercontent.com/u/145687605?v=4&s=18" alt="avatar" width="18"/> [Madhumita](https://github.com/madhumitaaa '+20/-68 (#7198 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/24915252?v=4&s=18" alt="avatar" width="18"/> [Tackoil](https://github.com/Tackoil "+80/-2 (#6269 )")
|
- <img src="https://avatars.githubusercontent.com/u/24915252?v=4&s=18" alt="avatar" width="18"/> [Tackoil](https://github.com/Tackoil '+80/-2 (#6269 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/145078271?v=4&s=18" alt="avatar" width="18"/> [Justin Dhillon](https://github.com/justindhillon "+41/-41 (#6324 #6315 )")
|
- <img src="https://avatars.githubusercontent.com/u/145078271?v=4&s=18" alt="avatar" width="18"/> [Justin Dhillon](https://github.com/justindhillon '+41/-41 (#6324 #6315 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/184138832?v=4&s=18" alt="avatar" width="18"/> [Rudransh](https://github.com/Rudrxxx "+71/-2 (#7257 )")
|
- <img src="https://avatars.githubusercontent.com/u/184138832?v=4&s=18" alt="avatar" width="18"/> [Rudransh](https://github.com/Rudrxxx '+71/-2 (#7257 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/146366930?v=4&s=18" alt="avatar" width="18"/> [WuMingDao](https://github.com/WuMingDao "+36/-36 (#7215 )")
|
- <img src="https://avatars.githubusercontent.com/u/146366930?v=4&s=18" alt="avatar" width="18"/> [WuMingDao](https://github.com/WuMingDao '+36/-36 (#7215 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/46827243?v=4&s=18" alt="avatar" width="18"/> [codenomnom](https://github.com/codenomnom "+70/-0 (#7201 #7201 )")
|
- <img src="https://avatars.githubusercontent.com/u/46827243?v=4&s=18" alt="avatar" width="18"/> [codenomnom](https://github.com/codenomnom '+70/-0 (#7201 #7201 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/189698992?v=4&s=18" alt="avatar" width="18"/> [Nandan Acharya](https://github.com/Nandann018-ux "+60/-10 (#7272 )")
|
- <img src="https://avatars.githubusercontent.com/u/189698992?v=4&s=18" alt="avatar" width="18"/> [Nandan Acharya](https://github.com/Nandann018-ux '+60/-10 (#7272 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/7225168?v=4&s=18" alt="avatar" width="18"/> [Eric Dubé](https://github.com/KernelDeimos "+22/-40 (#7042 )")
|
- <img src="https://avatars.githubusercontent.com/u/7225168?v=4&s=18" alt="avatar" width="18"/> [Eric Dubé](https://github.com/KernelDeimos '+22/-40 (#7042 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/915045?v=4&s=18" alt="avatar" width="18"/> [Tibor Pilz](https://github.com/tiborpilz "+40/-4 (#5551 )")
|
- <img src="https://avatars.githubusercontent.com/u/915045?v=4&s=18" alt="avatar" width="18"/> [Tibor Pilz](https://github.com/tiborpilz '+40/-4 (#5551 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/23138717?v=4&s=18" alt="avatar" width="18"/> [Gabriel Quaresma](https://github.com/joaoGabriel55 "+31/-4 (#6314 )")
|
- <img src="https://avatars.githubusercontent.com/u/23138717?v=4&s=18" alt="avatar" width="18"/> [Gabriel Quaresma](https://github.com/joaoGabriel55 '+31/-4 (#6314 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/21505?v=4&s=18" alt="avatar" width="18"/> [Turadg Aleahmad](https://github.com/turadg "+23/-6 (#6265 )")
|
- <img src="https://avatars.githubusercontent.com/u/21505?v=4&s=18" alt="avatar" width="18"/> [Turadg Aleahmad](https://github.com/turadg '+23/-6 (#6265 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/4273631?v=4&s=18" alt="avatar" width="18"/> [JohnTitor](https://github.com/kiritosan "+14/-14 (#6155 )")
|
- <img src="https://avatars.githubusercontent.com/u/4273631?v=4&s=18" alt="avatar" width="18"/> [JohnTitor](https://github.com/kiritosan '+14/-14 (#6155 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/39668736?v=4&s=18" alt="avatar" width="18"/> [rohit miryala](https://github.com/rohitmiryala "+22/-0 (#7250 )")
|
- <img src="https://avatars.githubusercontent.com/u/39668736?v=4&s=18" alt="avatar" width="18"/> [rohit miryala](https://github.com/rohitmiryala '+22/-0 (#7250 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/30316250?v=4&s=18" alt="avatar" width="18"/> [Wilson Mun](https://github.com/wmundev "+20/-0 (#6053 )")
|
- <img src="https://avatars.githubusercontent.com/u/30316250?v=4&s=18" alt="avatar" width="18"/> [Wilson Mun](https://github.com/wmundev '+20/-0 (#6053 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/184506226?v=4&s=18" alt="avatar" width="18"/> [techcodie](https://github.com/techcodie "+7/-7 (#7236 )")
|
- <img src="https://avatars.githubusercontent.com/u/184506226?v=4&s=18" alt="avatar" width="18"/> [techcodie](https://github.com/techcodie '+7/-7 (#7236 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/187598667?v=4&s=18" alt="avatar" width="18"/> [Ved Vadnere](https://github.com/Archis009 "+5/-6 (#7283 )")
|
- <img src="https://avatars.githubusercontent.com/u/187598667?v=4&s=18" alt="avatar" width="18"/> [Ved Vadnere](https://github.com/Archis009 '+5/-6 (#7283 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/115612815?v=4&s=18" alt="avatar" width="18"/> [svihpinc](https://github.com/svihpinc "+5/-3 (#6134 )")
|
- <img src="https://avatars.githubusercontent.com/u/115612815?v=4&s=18" alt="avatar" width="18"/> [svihpinc](https://github.com/svihpinc '+5/-3 (#6134 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/123884782?v=4&s=18" alt="avatar" width="18"/> [SANDESH LENDVE](https://github.com/mrsandy1965 "+3/-3 (#7246 )")
|
- <img src="https://avatars.githubusercontent.com/u/123884782?v=4&s=18" alt="avatar" width="18"/> [SANDESH LENDVE](https://github.com/mrsandy1965 '+3/-3 (#7246 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/12529395?v=4&s=18" alt="avatar" width="18"/> [Lubos](https://github.com/mrlubos "+5/-1 (#7312 )")
|
- <img src="https://avatars.githubusercontent.com/u/12529395?v=4&s=18" alt="avatar" width="18"/> [Lubos](https://github.com/mrlubos '+5/-1 (#7312 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/709451?v=4&s=18" alt="avatar" width="18"/> [Jarred Sumner](https://github.com/Jarred-Sumner "+5/-1 (#5754 )")
|
- <img src="https://avatars.githubusercontent.com/u/709451?v=4&s=18" alt="avatar" width="18"/> [Jarred Sumner](https://github.com/Jarred-Sumner '+5/-1 (#5754 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/17907922?v=4&s=18" alt="avatar" width="18"/> [Adam Hines](https://github.com/thebanjomatic "+2/-1 (#5756 )")
|
- <img src="https://avatars.githubusercontent.com/u/17907922?v=4&s=18" alt="avatar" width="18"/> [Adam Hines](https://github.com/thebanjomatic '+2/-1 (#5756 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/177472603?v=4&s=18" alt="avatar" width="18"/> [Subhan Kumar Rai](https://github.com/Subhan030 "+2/-1 (#7256 )")
|
- <img src="https://avatars.githubusercontent.com/u/177472603?v=4&s=18" alt="avatar" width="18"/> [Subhan Kumar Rai](https://github.com/Subhan030 '+2/-1 (#7256 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/6473925?v=4&s=18" alt="avatar" width="18"/> [Joseph Frazier](https://github.com/josephfrazier "+1/-1 (#7311 )")
|
- <img src="https://avatars.githubusercontent.com/u/6473925?v=4&s=18" alt="avatar" width="18"/> [Joseph Frazier](https://github.com/josephfrazier '+1/-1 (#7311 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/184906930?v=4&s=18" alt="avatar" width="18"/> [KT0803](https://github.com/KT0803 "+0/-2 (#7229 )")
|
- <img src="https://avatars.githubusercontent.com/u/184906930?v=4&s=18" alt="avatar" width="18"/> [KT0803](https://github.com/KT0803 '+0/-2 (#7229 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/6703955?v=4&s=18" alt="avatar" width="18"/> [Albie](https://github.com/AlbertoSadoc "+1/-1 (#5560 )")
|
- <img src="https://avatars.githubusercontent.com/u/6703955?v=4&s=18" alt="avatar" width="18"/> [Albie](https://github.com/AlbertoSadoc '+1/-1 (#5560 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/9452325?v=4&s=18" alt="avatar" width="18"/> [Jake Hayes](https://github.com/thejayhaykid "+1/-0 (#5999 )")
|
- <img src="https://avatars.githubusercontent.com/u/9452325?v=4&s=18" alt="avatar" width="18"/> [Jake Hayes](https://github.com/thejayhaykid '+1/-0 (#5999 )')
|
||||||
|
|
||||||
## [1.13.2](https://github.com/axios/axios/compare/v1.13.1...v1.13.2) (2025-11-04)
|
## [1.13.2](https://github.com/axios/axios/compare/v1.13.1...v1.13.2) (2025-11-04)
|
||||||
|
|
||||||
@@ -77,8 +77,8 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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 "+28/-9 (#7206 #7202 )")
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS '+28/-9 (#7206 #7202 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/1174718?v=4&s=18" alt="avatar" width="18"/> [Kasper Isager Dalsgarð](https://github.com/kasperisager "+9/-9 (#7196 )")
|
- <img src="https://avatars.githubusercontent.com/u/1174718?v=4&s=18" alt="avatar" width="18"/> [Kasper Isager Dalsgarð](https://github.com/kasperisager '+9/-9 (#7196 )')
|
||||||
|
|
||||||
## [1.13.1](https://github.com/axios/axios/compare/v1.13.0...v1.13.1) (2025-10-28)
|
## [1.13.1](https://github.com/axios/axios/compare/v1.13.0...v1.13.1) (2025-10-28)
|
||||||
|
|
||||||
@@ -88,8 +88,8 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### Contributors to this release
|
||||||
|
|
||||||
- <img src="https://avatars.githubusercontent.com/u/128113546?v=4&s=18" alt="avatar" width="18"/> [Anchal Singh](https://github.com/imanchalsingh "+220/-111 (#7173 )")
|
- <img src="https://avatars.githubusercontent.com/u/128113546?v=4&s=18" alt="avatar" width="18"/> [Anchal Singh](https://github.com/imanchalsingh '+220/-111 (#7173 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+18/-1 (#7193 )")
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS '+18/-1 (#7193 )')
|
||||||
|
|
||||||
# [1.13.0](https://github.com/axios/axios/compare/v1.12.2...v1.13.0) (2025-10-27)
|
# [1.13.0](https://github.com/axios/axios/compare/v1.12.2...v1.13.0) (2025-10-27)
|
||||||
|
|
||||||
@@ -104,23 +104,23 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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 "+794/-180 (#7186 #7150 #7039 )")
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS '+794/-180 (#7186 #7150 #7039 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/189505037?v=4&s=18" alt="avatar" width="18"/> [Noritaka Kobayashi](https://github.com/noritaka1166 "+24/-509 (#7032 )")
|
- <img src="https://avatars.githubusercontent.com/u/189505037?v=4&s=18" alt="avatar" width="18"/> [Noritaka Kobayashi](https://github.com/noritaka1166 '+24/-509 (#7032 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/195581631?v=4&s=18" alt="avatar" width="18"/> [Aviraj2929](https://github.com/Aviraj2929 "+211/-93 (#7136 #7135 #7134 #7112 )")
|
- <img src="https://avatars.githubusercontent.com/u/195581631?v=4&s=18" alt="avatar" width="18"/> [Aviraj2929](https://github.com/Aviraj2929 '+211/-93 (#7136 #7135 #7134 #7112 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/181717941?v=4&s=18" alt="avatar" width="18"/> [prasoon patel](https://github.com/Prasoon52 "+167/-6 (#7099 )")
|
- <img src="https://avatars.githubusercontent.com/u/181717941?v=4&s=18" alt="avatar" width="18"/> [prasoon patel](https://github.com/Prasoon52 '+167/-6 (#7099 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/141911040?v=4&s=18" alt="avatar" width="18"/> [Samyak Dandge](https://github.com/Samy-in "+134/-0 (#7171 )")
|
- <img src="https://avatars.githubusercontent.com/u/141911040?v=4&s=18" alt="avatar" width="18"/> [Samyak Dandge](https://github.com/Samy-in '+134/-0 (#7171 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/128113546?v=4&s=18" alt="avatar" width="18"/> [Anchal Singh](https://github.com/imanchalsingh "+53/-56 (#7170 )")
|
- <img src="https://avatars.githubusercontent.com/u/128113546?v=4&s=18" alt="avatar" width="18"/> [Anchal Singh](https://github.com/imanchalsingh '+53/-56 (#7170 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/146073621?v=4&s=18" alt="avatar" width="18"/> [Rahul Kumar](https://github.com/jaiyankargupta "+28/-28 (#7073 )")
|
- <img src="https://avatars.githubusercontent.com/u/146073621?v=4&s=18" alt="avatar" width="18"/> [Rahul Kumar](https://github.com/jaiyankargupta '+28/-28 (#7073 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/148716794?v=4&s=18" alt="avatar" width="18"/> [Amit Verma](https://github.com/Amitverma0509 "+24/-13 (#7129 )")
|
- <img src="https://avatars.githubusercontent.com/u/148716794?v=4&s=18" alt="avatar" width="18"/> [Amit Verma](https://github.com/Amitverma0509 '+24/-13 (#7129 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/141427581?v=4&s=18" alt="avatar" width="18"/> [Abhishek3880](https://github.com/abhishekmaniy "+23/-4 (#7119 #7117 #7116 #7115 )")
|
- <img src="https://avatars.githubusercontent.com/u/141427581?v=4&s=18" alt="avatar" width="18"/> [Abhishek3880](https://github.com/abhishekmaniy '+23/-4 (#7119 #7117 #7116 #7115 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/91522146?v=4&s=18" alt="avatar" width="18"/> [Dhvani Maktuporia](https://github.com/Dhvani365 "+14/-5 (#7175 )")
|
- <img src="https://avatars.githubusercontent.com/u/91522146?v=4&s=18" alt="avatar" width="18"/> [Dhvani Maktuporia](https://github.com/Dhvani365 '+14/-5 (#7175 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/41838423?v=4&s=18" alt="avatar" width="18"/> [Usama Ayoub](https://github.com/sam3690 "+4/-4 (#7133 )")
|
- <img src="https://avatars.githubusercontent.com/u/41838423?v=4&s=18" alt="avatar" width="18"/> [Usama Ayoub](https://github.com/sam3690 '+4/-4 (#7133 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/79366821?v=4&s=18" alt="avatar" width="18"/> [ikuy1203](https://github.com/ikuy1203 "+3/-3 (#7166 )")
|
- <img src="https://avatars.githubusercontent.com/u/79366821?v=4&s=18" alt="avatar" width="18"/> [ikuy1203](https://github.com/ikuy1203 '+3/-3 (#7166 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/74639234?v=4&s=18" alt="avatar" width="18"/> [Nikhil Simon Toppo](https://github.com/Kirito-Excalibur "+1/-1 (#7172 )")
|
- <img src="https://avatars.githubusercontent.com/u/74639234?v=4&s=18" alt="avatar" width="18"/> [Nikhil Simon Toppo](https://github.com/Kirito-Excalibur '+1/-1 (#7172 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/200562195?v=4&s=18" alt="avatar" width="18"/> [Jane Wangari](https://github.com/Wangarijane "+1/-1 (#7155 )")
|
- <img src="https://avatars.githubusercontent.com/u/200562195?v=4&s=18" alt="avatar" width="18"/> [Jane Wangari](https://github.com/Wangarijane '+1/-1 (#7155 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/78318848?v=4&s=18" alt="avatar" width="18"/> [Supakorn Ieamgomol](https://github.com/Supakornn "+1/-1 (#7065 )")
|
- <img src="https://avatars.githubusercontent.com/u/78318848?v=4&s=18" alt="avatar" width="18"/> [Supakorn Ieamgomol](https://github.com/Supakornn '+1/-1 (#7065 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/134518?v=4&s=18" alt="avatar" width="18"/> [Kian-Meng Ang](https://github.com/kianmeng "+1/-1 (#7046 )")
|
- <img src="https://avatars.githubusercontent.com/u/134518?v=4&s=18" alt="avatar" width="18"/> [Kian-Meng Ang](https://github.com/kianmeng '+1/-1 (#7046 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/13148112?v=4&s=18" alt="avatar" width="18"/> [UTSUMI Keiji](https://github.com/k-utsumi "+1/-1 (#7037 )")
|
- <img src="https://avatars.githubusercontent.com/u/13148112?v=4&s=18" alt="avatar" width="18"/> [UTSUMI Keiji](https://github.com/k-utsumi '+1/-1 (#7037 )')
|
||||||
|
|
||||||
## [1.12.2](https://github.com/axios/axios/compare/v1.12.1...v1.12.2) (2025-09-14)
|
## [1.12.2](https://github.com/axios/axios/compare/v1.12.1...v1.12.2) (2025-09-14)
|
||||||
|
|
||||||
@@ -130,8 +130,8 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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 "+247/-16 (#7030 #7022 #7024 )")
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS '+247/-16 (#7030 #7022 #7024 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/189505037?v=4&s=18" alt="avatar" width="18"/> [Noritaka Kobayashi](https://github.com/noritaka1166 "+2/-6 (#7028 #7029 )")
|
- <img src="https://avatars.githubusercontent.com/u/189505037?v=4&s=18" alt="avatar" width="18"/> [Noritaka Kobayashi](https://github.com/noritaka1166 '+2/-6 (#7028 #7029 )')
|
||||||
|
|
||||||
## [1.12.1](https://github.com/axios/axios/compare/v1.12.0...v1.12.1) (2025-09-12)
|
## [1.12.1](https://github.com/axios/axios/compare/v1.12.0...v1.12.1) (2025-09-12)
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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 "+10/-4 (#7020 )")
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS '+10/-4 (#7020 )')
|
||||||
|
|
||||||
# [1.12.0](https://github.com/axios/axios/compare/v1.11.0...v1.12.0) (2025-09-11)
|
# [1.12.0](https://github.com/axios/axios/compare/v1.11.0...v1.12.0) (2025-09-11)
|
||||||
|
|
||||||
@@ -165,16 +165,16 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### Contributors to this release
|
||||||
|
|
||||||
- <img src="https://avatars.githubusercontent.com/u/22686401?v=4&s=18" alt="avatar" width="18"/> [Willian Agostini](https://github.com/WillianAgostini "+132/-16760 (#7002 #5926 #6782 )")
|
- <img src="https://avatars.githubusercontent.com/u/22686401?v=4&s=18" alt="avatar" width="18"/> [Willian Agostini](https://github.com/WillianAgostini '+132/-16760 (#7002 #5926 #6782 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+4263/-293 (#7006 #7003 )")
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS '+4263/-293 (#7006 #7003 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/53833811?v=4&s=18" alt="avatar" width="18"/> [khani](https://github.com/mkhani01 "+111/-15 (#6982 )")
|
- <img src="https://avatars.githubusercontent.com/u/53833811?v=4&s=18" alt="avatar" width="18"/> [khani](https://github.com/mkhani01 '+111/-15 (#6982 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/7712804?v=4&s=18" alt="avatar" width="18"/> [Ameer Assadi](https://github.com/AmeerAssadi "+123/-0 (#7011 )")
|
- <img src="https://avatars.githubusercontent.com/u/7712804?v=4&s=18" alt="avatar" width="18"/> [Ameer Assadi](https://github.com/AmeerAssadi '+123/-0 (#7011 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/70265727?v=4&s=18" alt="avatar" width="18"/> [Emiedonmokumo Dick-Boro](https://github.com/emiedonmokumo "+55/-35 (#6998 )")
|
- <img src="https://avatars.githubusercontent.com/u/70265727?v=4&s=18" alt="avatar" width="18"/> [Emiedonmokumo Dick-Boro](https://github.com/emiedonmokumo '+55/-35 (#6998 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/47859767?v=4&s=18" alt="avatar" width="18"/> [Zeroday BYTE](https://github.com/opsysdebug "+8/-8 (#6980 )")
|
- <img src="https://avatars.githubusercontent.com/u/47859767?v=4&s=18" alt="avatar" width="18"/> [Zeroday BYTE](https://github.com/opsysdebug '+8/-8 (#6980 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/4814473?v=4&s=18" alt="avatar" width="18"/> [Jason Saayman](https://github.com/jasonsaayman "+7/-7 (#6985 #6985 )")
|
- <img src="https://avatars.githubusercontent.com/u/4814473?v=4&s=18" alt="avatar" width="18"/> [Jason Saayman](https://github.com/jasonsaayman '+7/-7 (#6985 #6985 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/13010755?v=4&s=18" alt="avatar" width="18"/> [최예찬](https://github.com/HealGaren "+5/-7 (#5715 )")
|
- <img src="https://avatars.githubusercontent.com/u/13010755?v=4&s=18" alt="avatar" width="18"/> [최예찬](https://github.com/HealGaren '+5/-7 (#5715 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/7002604?v=4&s=18" alt="avatar" width="18"/> [Gligor Kotushevski](https://github.com/gligorkot "+3/-1 (#5627 )")
|
- <img src="https://avatars.githubusercontent.com/u/7002604?v=4&s=18" alt="avatar" width="18"/> [Gligor Kotushevski](https://github.com/gligorkot '+3/-1 (#5627 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/15893?v=4&s=18" alt="avatar" width="18"/> [Aleksandar Dimitrov](https://github.com/adimit "+2/-1 (#5595 )")
|
- <img src="https://avatars.githubusercontent.com/u/15893?v=4&s=18" alt="avatar" width="18"/> [Aleksandar Dimitrov](https://github.com/adimit '+2/-1 (#5595 )')
|
||||||
|
|
||||||
# [1.11.0](https://github.com/axios/axios/compare/v1.10.0...v1.11.0) (2025-07-22)
|
# [1.11.0](https://github.com/axios/axios/compare/v1.10.0...v1.11.0) (2025-07-22)
|
||||||
|
|
||||||
@@ -186,11 +186,11 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### Contributors to this release
|
||||||
|
|
||||||
- <img src="https://avatars.githubusercontent.com/u/12534341?v=4&s=18" alt="avatar" width="18"/> [izzy goldman](https://github.com/izzygld "+186/-93 (#6970 )")
|
- <img src="https://avatars.githubusercontent.com/u/12534341?v=4&s=18" alt="avatar" width="18"/> [izzy goldman](https://github.com/izzygld '+186/-93 (#6970 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/142807367?v=4&s=18" alt="avatar" width="18"/> [Manish Sahani](https://github.com/manishsahanidev "+70/-0 (#6961 )")
|
- <img src="https://avatars.githubusercontent.com/u/142807367?v=4&s=18" alt="avatar" width="18"/> [Manish Sahani](https://github.com/manishsahanidev '+70/-0 (#6961 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/189505037?v=4&s=18" alt="avatar" width="18"/> [Noritaka Kobayashi](https://github.com/noritaka1166 "+12/-10 (#6938 #6939 )")
|
- <img src="https://avatars.githubusercontent.com/u/189505037?v=4&s=18" alt="avatar" width="18"/> [Noritaka Kobayashi](https://github.com/noritaka1166 '+12/-10 (#6938 #6939 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/392612?v=4&s=18" alt="avatar" width="18"/> [James Nail](https://github.com/jrnail23 "+13/-2 (#6956 )")
|
- <img src="https://avatars.githubusercontent.com/u/392612?v=4&s=18" alt="avatar" width="18"/> [James Nail](https://github.com/jrnail23 '+13/-2 (#6956 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/163745239?v=4&s=18" alt="avatar" width="18"/> [Tejaswi1305](https://github.com/Tejaswi1305 "+1/-1 (#6894 )")
|
- <img src="https://avatars.githubusercontent.com/u/163745239?v=4&s=18" alt="avatar" width="18"/> [Tejaswi1305](https://github.com/Tejaswi1305 '+1/-1 (#6894 )')
|
||||||
|
|
||||||
# [1.10.0](https://github.com/axios/axios/compare/v1.9.0...v1.10.0) (2025-06-14)
|
# [1.10.0](https://github.com/axios/axios/compare/v1.9.0...v1.10.0) (2025-06-14)
|
||||||
|
|
||||||
@@ -206,13 +206,13 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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/-19 (#6933 #6920 #6893 #6892 )")
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS '+30/-19 (#6933 #6920 #6893 #6892 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/189505037?v=4&s=18" alt="avatar" width="18"/> [Noritaka Kobayashi](https://github.com/noritaka1166 "+2/-6 (#6922 #6923 )")
|
- <img src="https://avatars.githubusercontent.com/u/189505037?v=4&s=18" alt="avatar" width="18"/> [Noritaka Kobayashi](https://github.com/noritaka1166 '+2/-6 (#6922 #6923 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/48370490?v=4&s=18" alt="avatar" width="18"/> [Dimitrios Lazanas](https://github.com/dimitry-lzs "+4/-0 (#6917 )")
|
- <img src="https://avatars.githubusercontent.com/u/48370490?v=4&s=18" alt="avatar" width="18"/> [Dimitrios Lazanas](https://github.com/dimitry-lzs '+4/-0 (#6917 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/71047946?v=4&s=18" alt="avatar" width="18"/> [Adrian Knapp](https://github.com/AdrianKnapp "+2/-2 (#6867 )")
|
- <img src="https://avatars.githubusercontent.com/u/71047946?v=4&s=18" alt="avatar" width="18"/> [Adrian Knapp](https://github.com/AdrianKnapp '+2/-2 (#6867 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/16129206?v=4&s=18" alt="avatar" width="18"/> [Howie Zhao](https://github.com/howiezhao "+3/-1 (#6872 )")
|
- <img src="https://avatars.githubusercontent.com/u/16129206?v=4&s=18" alt="avatar" width="18"/> [Howie Zhao](https://github.com/howiezhao '+3/-1 (#6872 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/6788611?v=4&s=18" alt="avatar" width="18"/> [Uhyeon Park](https://github.com/warpdev "+1/-1 (#6883 )")
|
- <img src="https://avatars.githubusercontent.com/u/6788611?v=4&s=18" alt="avatar" width="18"/> [Uhyeon Park](https://github.com/warpdev '+1/-1 (#6883 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/20028934?v=4&s=18" alt="avatar" width="18"/> [Sampo Silvennoinen](https://github.com/stscoundrel "+1/-1 (#6913 )")
|
- <img src="https://avatars.githubusercontent.com/u/20028934?v=4&s=18" alt="avatar" width="18"/> [Sampo Silvennoinen](https://github.com/stscoundrel '+1/-1 (#6913 )')
|
||||||
|
|
||||||
# [1.9.0](https://github.com/axios/axios/compare/v1.8.4...v1.9.0) (2025-04-24)
|
# [1.9.0](https://github.com/axios/axios/compare/v1.8.4...v1.9.0) (2025-04-24)
|
||||||
|
|
||||||
@@ -232,12 +232,12 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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 "+200/-34 (#6890 #6889 #6888 #6885 #6881 #6767 #6874 #6873 )")
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS '+200/-34 (#6890 #6889 #6888 #6885 #6881 #6767 #6874 #6873 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/4814473?v=4&s=18" alt="avatar" width="18"/> [Jay](https://github.com/jasonsaayman "+26/-1 ()")
|
- <img src="https://avatars.githubusercontent.com/u/4814473?v=4&s=18" alt="avatar" width="18"/> [Jay](https://github.com/jasonsaayman '+26/-1 ()')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/22686401?v=4&s=18" alt="avatar" width="18"/> [Willian Agostini](https://github.com/WillianAgostini "+21/-0 (#5707 )")
|
- <img src="https://avatars.githubusercontent.com/u/22686401?v=4&s=18" alt="avatar" width="18"/> [Willian Agostini](https://github.com/WillianAgostini '+21/-0 (#5707 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/2500247?v=4&s=18" alt="avatar" width="18"/> [George Cheng](https://github.com/Gerhut "+3/-3 (#5096 )")
|
- <img src="https://avatars.githubusercontent.com/u/2500247?v=4&s=18" alt="avatar" width="18"/> [George Cheng](https://github.com/Gerhut '+3/-3 (#5096 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/30260221?v=4&s=18" alt="avatar" width="18"/> [FatahChan](https://github.com/FatahChan "+2/-2 (#6855 )")
|
- <img src="https://avatars.githubusercontent.com/u/30260221?v=4&s=18" alt="avatar" width="18"/> [FatahChan](https://github.com/FatahChan '+2/-2 (#6855 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/49002?v=4&s=18" alt="avatar" width="18"/> [Ionuț G. Stan](https://github.com/igstan "+1/-1 (#6661 )")
|
- <img src="https://avatars.githubusercontent.com/u/49002?v=4&s=18" alt="avatar" width="18"/> [Ionuț G. Stan](https://github.com/igstan '+1/-1 (#6661 )')
|
||||||
|
|
||||||
## [1.8.4](https://github.com/axios/axios/compare/v1.8.3...v1.8.4) (2025-03-19)
|
## [1.8.4](https://github.com/axios/axios/compare/v1.8.3...v1.8.4) (2025-03-19)
|
||||||
|
|
||||||
@@ -247,7 +247,7 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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 )")
|
- <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)
|
## [1.8.3](https://github.com/axios/axios/compare/v1.8.2...v1.8.3) (2025-03-10)
|
||||||
|
|
||||||
@@ -258,9 +258,9 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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/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/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 )")
|
- <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)
|
## [1.8.2](https://github.com/axios/axios/compare/v1.8.1...v1.8.2) (2025-03-07)
|
||||||
|
|
||||||
@@ -270,7 +270,7 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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 )")
|
- <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)
|
## [1.8.1](https://github.com/axios/axios/compare/v1.8.0...v1.8.1) (2025-02-26)
|
||||||
|
|
||||||
@@ -280,7 +280,7 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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 )")
|
- <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)
|
# [1.8.0](https://github.com/axios/axios/compare/v1.7.9...v1.8.0) (2025-02-25)
|
||||||
|
|
||||||
@@ -310,23 +310,23 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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/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/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/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/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/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/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/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/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/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/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 )")
|
- <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
|
- 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/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/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/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/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 )")
|
- <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)
|
## [1.7.9](https://github.com/axios/axios/compare/v1.7.8...v1.7.9) (2024-12-04)
|
||||||
|
|
||||||
@@ -336,7 +336,7 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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 )")
|
- <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)
|
## [1.7.8](https://github.com/axios/axios/compare/v1.7.7...v1.7.8) (2024-11-25)
|
||||||
|
|
||||||
@@ -356,24 +356,24 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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 )")
|
- <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)
|
## [1.7.7](https://github.com/axios/axios/compare/v1.7.6...v1.7.7) (2024-08-31)
|
||||||
|
|
||||||
@@ -384,8 +384,8 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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/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 )")
|
- <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)
|
## [1.7.6](https://github.com/axios/axios/compare/v1.7.5...v1.7.6) (2024-08-30)
|
||||||
|
|
||||||
@@ -396,9 +396,9 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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/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/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 )")
|
- <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)
|
## [1.7.5](https://github.com/axios/axios/compare/v1.7.4...v1.7.5) (2024-08-23)
|
||||||
|
|
||||||
@@ -411,9 +411,9 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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/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/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 )")
|
- <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)
|
## [1.7.4](https://github.com/axios/axios/compare/v1.7.3...v1.7.4) (2024-08-13)
|
||||||
|
|
||||||
@@ -424,8 +424,8 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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/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 )")
|
- <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)
|
## [1.7.3](https://github.com/axios/axios/compare/v1.7.2...v1.7.3) (2024-08-01)
|
||||||
|
|
||||||
@@ -437,9 +437,9 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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/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/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 )")
|
- <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)
|
## [1.7.2](https://github.com/axios/axios/compare/v1.7.1...v1.7.2) (2024-05-21)
|
||||||
|
|
||||||
@@ -449,7 +449,7 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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 )")
|
- <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)
|
## [1.7.1](https://github.com/axios/axios/compare/v1.7.0...v1.7.1) (2024-05-20)
|
||||||
|
|
||||||
@@ -459,7 +459,7 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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 )")
|
- <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)
|
# [1.7.0](https://github.com/axios/axios/compare/v1.7.0-beta.2...v1.7.0) (2024-05-19)
|
||||||
|
|
||||||
@@ -473,9 +473,9 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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/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/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 )")
|
- <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)
|
# [1.7.0-beta.2](https://github.com/axios/axios/compare/v1.7.0-beta.1...v1.7.0-beta.2) (2024-05-19)
|
||||||
|
|
||||||
@@ -487,7 +487,7 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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 )")
|
- <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)
|
# [1.7.0-beta.1](https://github.com/axios/axios/compare/v1.7.0-beta.0...v1.7.0-beta.1) (2024-05-07)
|
||||||
|
|
||||||
@@ -499,8 +499,8 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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/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 )")
|
- <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)
|
# [1.7.0-beta.0](https://github.com/axios/axios/compare/v1.6.8...v1.7.0-beta.0) (2024-04-28)
|
||||||
|
|
||||||
@@ -510,8 +510,8 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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/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/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)
|
## [1.6.8](https://github.com/axios/axios/compare/v1.6.7...v1.6.8) (2024-03-15)
|
||||||
|
|
||||||
@@ -523,13 +523,13 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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/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/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/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/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/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/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 )")
|
- <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)
|
## [1.6.7](https://github.com/axios/axios/compare/v1.6.6...v1.6.7) (2024-01-25)
|
||||||
|
|
||||||
@@ -539,8 +539,8 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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/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 )")
|
- <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)
|
## [1.6.6](https://github.com/axios/axios/compare/v1.6.5...v1.6.6) (2024-01-24)
|
||||||
|
|
||||||
@@ -551,8 +551,8 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### Contributors to this release
|
||||||
|
|
||||||
- <img src="https://avatars.githubusercontent.com/u/1186084?v=4&s=18" alt="avatar" width="18"/> [Ilya Priven](https://github.com/ikonst "+91/-8 (#5987 )")
|
- <img src="https://avatars.githubusercontent.com/u/1186084?v=4&s=18" alt="avatar" width="18"/> [Ilya Priven](https://github.com/ikonst '+91/-8 (#5987 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/1884246?v=4&s=18" alt="avatar" width="18"/> [Zao Soula](https://github.com/zaosoula "+6/-6 (#5778 )")
|
- <img src="https://avatars.githubusercontent.com/u/1884246?v=4&s=18" alt="avatar" width="18"/> [Zao Soula](https://github.com/zaosoula '+6/-6 (#5778 )')
|
||||||
|
|
||||||
## [1.6.5](https://github.com/axios/axios/compare/v1.6.4...v1.6.5) (2024-01-05)
|
## [1.6.5](https://github.com/axios/axios/compare/v1.6.4...v1.6.5) (2024-01-05)
|
||||||
|
|
||||||
@@ -563,8 +563,8 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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 "+41/-6 (#6176 #6175 )")
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS '+41/-6 (#6176 #6175 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/4814473?v=4&s=18" alt="avatar" width="18"/> [Jay](https://github.com/jasonsaayman "+6/-1 ()")
|
- <img src="https://avatars.githubusercontent.com/u/4814473?v=4&s=18" alt="avatar" width="18"/> [Jay](https://github.com/jasonsaayman '+6/-1 ()')
|
||||||
|
|
||||||
## [1.6.4](https://github.com/axios/axios/compare/v1.6.3...v1.6.4) (2024-01-03)
|
## [1.6.4](https://github.com/axios/axios/compare/v1.6.3...v1.6.4) (2024-01-03)
|
||||||
|
|
||||||
@@ -575,9 +575,9 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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 "+34/-6 ()")
|
- <img src="https://avatars.githubusercontent.com/u/4814473?v=4&s=18" alt="avatar" width="18"/> [Jay](https://github.com/jasonsaayman '+34/-6 ()')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+34/-3 (#6172 #6167 )")
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS '+34/-3 (#6172 #6167 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/1402060?v=4&s=18" alt="avatar" width="18"/> [Guy Nesher](https://github.com/gnesher "+10/-10 (#6163 )")
|
- <img src="https://avatars.githubusercontent.com/u/1402060?v=4&s=18" alt="avatar" width="18"/> [Guy Nesher](https://github.com/gnesher '+10/-10 (#6163 )')
|
||||||
|
|
||||||
## [1.6.3](https://github.com/axios/axios/compare/v1.6.2...v1.6.3) (2023-12-26)
|
## [1.6.3](https://github.com/axios/axios/compare/v1.6.2...v1.6.3) (2023-12-26)
|
||||||
|
|
||||||
@@ -587,9 +587,9 @@
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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 "+15/-6 (#6145 )")
|
- <img src="https://avatars.githubusercontent.com/u/4814473?v=4&s=18" alt="avatar" width="18"/> [Jay](https://github.com/jasonsaayman '+15/-6 (#6145 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/22686401?v=4&s=18" alt="avatar" width="18"/> [Willian Agostini](https://github.com/WillianAgostini "+17/-2 (#6132 )")
|
- <img src="https://avatars.githubusercontent.com/u/22686401?v=4&s=18" alt="avatar" width="18"/> [Willian Agostini](https://github.com/WillianAgostini '+17/-2 (#6132 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+3/-0 (#6084 )")
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS '+3/-0 (#6084 )')
|
||||||
|
|
||||||
## [1.6.2](https://github.com/axios/axios/compare/v1.6.1...v1.6.2) (2023-11-14)
|
## [1.6.2](https://github.com/axios/axios/compare/v1.6.1...v1.6.2) (2023-11-14)
|
||||||
|
|
||||||
@@ -610,9 +610,9 @@ This functionality is considered as a fix.
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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 "+271/-146 (#6081 #6080 #6079 #6078 #6046 #6064 #6063 )")
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS '+271/-146 (#6081 #6080 #6079 #6078 #6046 #6064 #6063 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/79681367?v=4&s=18" alt="avatar" width="18"/> [Ng Choon Khon (CK)](https://github.com/ckng0221 "+4/-4 (#6073 )")
|
- <img src="https://avatars.githubusercontent.com/u/79681367?v=4&s=18" alt="avatar" width="18"/> [Ng Choon Khon (CK)](https://github.com/ckng0221 '+4/-4 (#6073 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/9162827?v=4&s=18" alt="avatar" width="18"/> [Muhammad Noman](https://github.com/mnomanmemon "+2/-2 (#6048 )")
|
- <img src="https://avatars.githubusercontent.com/u/9162827?v=4&s=18" alt="avatar" width="18"/> [Muhammad Noman](https://github.com/mnomanmemon '+2/-2 (#6048 )')
|
||||||
|
|
||||||
## [1.6.1](https://github.com/axios/axios/compare/v1.6.0...v1.6.1) (2023-11-08)
|
## [1.6.1](https://github.com/axios/axios/compare/v1.6.0...v1.6.1) (2023-11-08)
|
||||||
|
|
||||||
@@ -623,8 +623,8 @@ This functionality is considered as a fix.
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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 "+432/-65 (#6059 #6056 #6055 )")
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS '+432/-65 (#6059 #6056 #6055 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/3982806?v=4&s=18" alt="avatar" width="18"/> [Fabian Meyer](https://github.com/meyfa "+5/-2 (#5835 )")
|
- <img src="https://avatars.githubusercontent.com/u/3982806?v=4&s=18" alt="avatar" width="18"/> [Fabian Meyer](https://github.com/meyfa '+5/-2 (#5835 )')
|
||||||
|
|
||||||
### PRs
|
### PRs
|
||||||
|
|
||||||
@@ -656,9 +656,9 @@ This functionality is considered as a fix.
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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 "+449/-114 (#6032 #6021 #6011 #5932 #5931 )")
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS '+449/-114 (#6032 #6021 #6011 #5932 #5931 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/63700910?v=4&s=18" alt="avatar" width="18"/> [Valentin Panov](https://github.com/valentin-panov "+4/-4 (#6028 )")
|
- <img src="https://avatars.githubusercontent.com/u/63700910?v=4&s=18" alt="avatar" width="18"/> [Valentin Panov](https://github.com/valentin-panov '+4/-4 (#6028 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/76877078?v=4&s=18" alt="avatar" width="18"/> [Rinku Chaudhari](https://github.com/therealrinku "+1/-1 (#5889 )")
|
- <img src="https://avatars.githubusercontent.com/u/76877078?v=4&s=18" alt="avatar" width="18"/> [Rinku Chaudhari](https://github.com/therealrinku '+1/-1 (#5889 )')
|
||||||
|
|
||||||
## [1.5.1](https://github.com/axios/axios/compare/v1.5.0...v1.5.1) (2023-09-26)
|
## [1.5.1](https://github.com/axios/axios/compare/v1.5.0...v1.5.1) (2023-09-26)
|
||||||
|
|
||||||
@@ -671,12 +671,12 @@ This functionality is considered as a fix.
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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 "+89/-18 (#5919 #5917 )")
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS '+89/-18 (#5919 #5917 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/110460234?v=4&s=18" alt="avatar" width="18"/> [David Dallas](https://github.com/DavidJDallas "+11/-5 ()")
|
- <img src="https://avatars.githubusercontent.com/u/110460234?v=4&s=18" alt="avatar" width="18"/> [David Dallas](https://github.com/DavidJDallas '+11/-5 ()')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/71556073?v=4&s=18" alt="avatar" width="18"/> [Sean Sattler](https://github.com/fb-sean "+2/-8 ()")
|
- <img src="https://avatars.githubusercontent.com/u/71556073?v=4&s=18" alt="avatar" width="18"/> [Sean Sattler](https://github.com/fb-sean '+2/-8 ()')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/4294069?v=4&s=18" alt="avatar" width="18"/> [Mustafa Ateş Uzun](https://github.com/0o001 "+4/-4 ()")
|
- <img src="https://avatars.githubusercontent.com/u/4294069?v=4&s=18" alt="avatar" width="18"/> [Mustafa Ateş Uzun](https://github.com/0o001 '+4/-4 ()')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/132928043?v=4&s=18" alt="avatar" width="18"/> [Przemyslaw Motacki](https://github.com/sfc-gh-pmotacki "+2/-1 (#5892 )")
|
- <img src="https://avatars.githubusercontent.com/u/132928043?v=4&s=18" alt="avatar" width="18"/> [Przemyslaw Motacki](https://github.com/sfc-gh-pmotacki '+2/-1 (#5892 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/5492927?v=4&s=18" alt="avatar" width="18"/> [Michael Di Prisco](https://github.com/Cadienvan "+1/-1 ()")
|
- <img src="https://avatars.githubusercontent.com/u/5492927?v=4&s=18" alt="avatar" width="18"/> [Michael Di Prisco](https://github.com/Cadienvan '+1/-1 ()')
|
||||||
|
|
||||||
### PRs
|
### PRs
|
||||||
|
|
||||||
@@ -703,10 +703,10 @@ This functionality is considered as a fix.
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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 "+66/-29 (#5839 #5837 #5836 #5832 #5831 )")
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS '+66/-29 (#5839 #5837 #5836 #5832 #5831 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/102841186?v=4&s=18" alt="avatar" width="18"/> [夜葬](https://github.com/geekact "+42/-0 (#5324 )")
|
- <img src="https://avatars.githubusercontent.com/u/102841186?v=4&s=18" alt="avatar" width="18"/> [夜葬](https://github.com/geekact '+42/-0 (#5324 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/65978976?v=4&s=18" alt="avatar" width="18"/> [Jonathan Budiman](https://github.com/JBudiman00 "+30/-0 (#5788 )")
|
- <img src="https://avatars.githubusercontent.com/u/65978976?v=4&s=18" alt="avatar" width="18"/> [Jonathan Budiman](https://github.com/JBudiman00 '+30/-0 (#5788 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/5492927?v=4&s=18" alt="avatar" width="18"/> [Michael Di Prisco](https://github.com/Cadienvan "+3/-5 (#5791 )")
|
- <img src="https://avatars.githubusercontent.com/u/5492927?v=4&s=18" alt="avatar" width="18"/> [Michael Di Prisco](https://github.com/Cadienvan '+3/-5 (#5791 )')
|
||||||
|
|
||||||
### PRs
|
### PRs
|
||||||
|
|
||||||
@@ -735,9 +735,9 @@ This functionality is considered as a fix.
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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 "+151/-16 (#5684 #5339 #5679 #5678 #5677 )")
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS '+151/-16 (#5684 #5339 #5679 #5678 #5677 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/47537704?v=4&s=18" alt="avatar" width="18"/> [Arthur Fiorette](https://github.com/arthurfiorette "+19/-19 (#5525 )")
|
- <img src="https://avatars.githubusercontent.com/u/47537704?v=4&s=18" alt="avatar" width="18"/> [Arthur Fiorette](https://github.com/arthurfiorette '+19/-19 (#5525 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/43876655?v=4&s=18" alt="avatar" width="18"/> [PIYUSH NEGI](https://github.com/npiyush97 "+2/-18 (#5670 )")
|
- <img src="https://avatars.githubusercontent.com/u/43876655?v=4&s=18" alt="avatar" width="18"/> [PIYUSH NEGI](https://github.com/npiyush97 '+2/-18 (#5670 )')
|
||||||
|
|
||||||
### PRs
|
### PRs
|
||||||
|
|
||||||
@@ -757,8 +757,8 @@ This functionality is considered as a fix.
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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 "+48/-10 (#5665 #5661 #5663 )")
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS '+48/-10 (#5665 #5661 #5663 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/5492927?v=4&s=18" alt="avatar" width="18"/> [Michael Di Prisco](https://github.com/Cadienvan "+2/-0 (#5445 )")
|
- <img src="https://avatars.githubusercontent.com/u/5492927?v=4&s=18" alt="avatar" width="18"/> [Michael Di Prisco](https://github.com/Cadienvan '+2/-0 (#5445 )')
|
||||||
|
|
||||||
### PRs
|
### PRs
|
||||||
|
|
||||||
@@ -778,7 +778,7 @@ This functionality is considered as a fix.
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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 "+28/-10 (#5633 #5584 )")
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS '+28/-10 (#5633 #5584 )')
|
||||||
|
|
||||||
### PRs
|
### PRs
|
||||||
|
|
||||||
@@ -798,9 +798,9 @@ This functionality is considered as a fix.
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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 "+38/-26 (#5564 )")
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS '+38/-26 (#5564 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/19550000?v=4&s=18" alt="avatar" width="18"/> [lcysgsg](https://github.com/lcysgsg "+4/-0 (#5548 )")
|
- <img src="https://avatars.githubusercontent.com/u/19550000?v=4&s=18" alt="avatar" width="18"/> [lcysgsg](https://github.com/lcysgsg '+4/-0 (#5548 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/5492927?v=4&s=18" alt="avatar" width="18"/> [Michael Di Prisco](https://github.com/Cadienvan "+3/-0 (#5444 )")
|
- <img src="https://avatars.githubusercontent.com/u/5492927?v=4&s=18" alt="avatar" width="18"/> [Michael Di Prisco](https://github.com/Cadienvan '+3/-0 (#5444 )')
|
||||||
|
|
||||||
### PRs
|
### PRs
|
||||||
|
|
||||||
@@ -821,8 +821,8 @@ This functionality is considered as a fix.
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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 "+11/-7 (#5545 #5535 #5542 )")
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS '+11/-7 (#5545 #5535 #5542 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/19842213?v=4&s=18" alt="avatar" width="18"/> [陈若枫](https://github.com/ruofee "+2/-2 (#5467 )")
|
- <img src="https://avatars.githubusercontent.com/u/19842213?v=4&s=18" alt="avatar" width="18"/> [陈若枫](https://github.com/ruofee '+2/-2 (#5467 )')
|
||||||
|
|
||||||
### PRs
|
### PRs
|
||||||
|
|
||||||
@@ -842,7 +842,7 @@ This functionality is considered as a fix.
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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 "+2/-1 (#5530 #5528 )")
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS '+2/-1 (#5530 #5528 )')
|
||||||
|
|
||||||
### PRs
|
### PRs
|
||||||
|
|
||||||
@@ -862,7 +862,7 @@ This functionality is considered as a fix.
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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 "+27/-8 (#5521 #5518 )")
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS '+27/-8 (#5521 #5518 )')
|
||||||
|
|
||||||
### PRs
|
### PRs
|
||||||
|
|
||||||
@@ -886,8 +886,8 @@ This functionality is considered as a fix.
|
|||||||
|
|
||||||
### Contributors to this release
|
### 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 "+352/-67 (#5514 #5512 #5510 #5509 #5508 #5316 #5507 )")
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS '+352/-67 (#5514 #5512 #5510 #5509 #5508 #5316 #5507 )')
|
||||||
- <img src="https://avatars.githubusercontent.com/u/35015993?v=4&s=18" alt="avatar" width="18"/> [ItsNotGoodName](https://github.com/ItsNotGoodName "+43/-2 (#5497 )")
|
- <img src="https://avatars.githubusercontent.com/u/35015993?v=4&s=18" alt="avatar" width="18"/> [ItsNotGoodName](https://github.com/ItsNotGoodName '+43/-2 (#5497 )')
|
||||||
|
|
||||||
### PRs
|
### PRs
|
||||||
|
|
||||||
@@ -907,7 +907,7 @@ This functionality is considered as a fix.
|
|||||||
|
|
||||||
### Contributors to this release
|
### Contributors to this release
|
||||||
|
|
||||||
-  [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+24/-9 (#5503 #5502 )")
|
-  [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS '+24/-9 (#5503 #5502 )')
|
||||||
|
|
||||||
### PRs
|
### PRs
|
||||||
|
|
||||||
@@ -926,8 +926,8 @@ This functionality is considered as a fix.
|
|||||||
|
|
||||||
### Contributors to this release
|
### Contributors to this release
|
||||||
|
|
||||||
-  [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+82/-54 (#5499 )")
|
-  [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS '+82/-54 (#5499 )')
|
||||||
-  [Elliot Ford](https://github.com/EFord36 "+1/-1 (#5462 )")
|
-  [Elliot Ford](https://github.com/EFord36 '+1/-1 (#5462 )')
|
||||||
|
|
||||||
### PRs
|
### PRs
|
||||||
|
|
||||||
@@ -947,8 +947,8 @@ This functionality is considered as a fix.
|
|||||||
|
|
||||||
### Contributors to this release
|
### Contributors to this release
|
||||||
|
|
||||||
-  [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+242/-108 (#5486 #5482 )")
|
-  [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS '+242/-108 (#5486 #5482 )')
|
||||||
-  [Daniel Hillmann](https://github.com/hilleer "+1/-1 (#5478 )")
|
-  [Daniel Hillmann](https://github.com/hilleer '+1/-1 (#5478 )')
|
||||||
|
|
||||||
### PRs
|
### PRs
|
||||||
|
|
||||||
@@ -967,7 +967,7 @@ This functionality is considered as a fix.
|
|||||||
|
|
||||||
### Contributors to this release
|
### Contributors to this release
|
||||||
|
|
||||||
-  [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+938/-442 (#5456 #5455 #5453 #5451 #5449 #5447 #5446 #5443 #5442 #5439 #5420 )")
|
-  [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS '+938/-442 (#5456 #5455 #5453 #5451 #5449 #5447 #5446 #5443 #5442 #5439 #5420 )')
|
||||||
|
|
||||||
### PRs
|
### PRs
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -18,4 +18,4 @@ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) f
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
*This list is manually maintained. If you've contributed and would like to be added, please submit a pull request!*
|
_This list is manually maintained. If you've contributed and would like to be added, please submit a pull request!_
|
||||||
|
|||||||
+47
-21
@@ -1,7 +1,7 @@
|
|||||||
import util from "util";
|
import util from 'util';
|
||||||
import cp from "child_process";
|
import cp from 'child_process';
|
||||||
import {parseVersion} from "./helpers/parser.js";
|
import { parseVersion } from './helpers/parser.js';
|
||||||
import githubAxios from "./githubAxios.js";
|
import githubAxios from './githubAxios.js';
|
||||||
import memoize from 'memoizee';
|
import memoize from 'memoizee';
|
||||||
|
|
||||||
const exec = util.promisify(cp.exec);
|
const exec = util.promisify(cp.exec);
|
||||||
@@ -20,7 +20,7 @@ export default class GithubAPI {
|
|||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
this.axios = githubAxios.create({
|
this.axios = githubAxios.create({
|
||||||
baseURL: `https://api.github.com/repos/${this.owner}/${this.repo}/`,
|
baseURL: `https://api.github.com/repos/${this.owner}/${this.repo}/`,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async createComment(issue, body) {
|
async createComment(issue, body) {
|
||||||
@@ -28,7 +28,11 @@ export default class GithubAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getComments(issue, { desc = false, per_page = 100, page = 1 } = {}) {
|
async getComments(issue, { desc = false, per_page = 100, page = 1 } = {}) {
|
||||||
return (await this.axios.get(`/issues/${issue}/comments`, {params: {direction: desc ? 'desc' : 'asc', per_page, page}})).data;
|
return (
|
||||||
|
await this.axios.get(`/issues/${issue}/comments`, {
|
||||||
|
params: { direction: desc ? 'desc' : 'asc', per_page, page },
|
||||||
|
})
|
||||||
|
).data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getComment(id) {
|
async getComment(id) {
|
||||||
@@ -51,7 +55,7 @@ export default class GithubAPI {
|
|||||||
try {
|
try {
|
||||||
return (await this.axios.get(`/collaborators/${user}`)).status === 204;
|
return (await this.axios.get(`/collaborators/${user}`)).status === 204;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
// Do nothing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,8 +71,19 @@ export default class GithubAPI {
|
|||||||
return (await this.axios.get(`/pulls/${issue}`)).data;
|
return (await this.axios.get(`/pulls/${issue}`)).data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getIssues({state= 'open', labels, sort = 'created', desc = false, per_page = 100, page = 1}) {
|
async getIssues({
|
||||||
return (await this.axios.get(`/issues`, {params: {state, labels, sort, direction: desc ? 'desc' : 'asc', per_page, page}})).data;
|
state = 'open',
|
||||||
|
labels,
|
||||||
|
sort = 'created',
|
||||||
|
desc = false,
|
||||||
|
per_page = 100,
|
||||||
|
page = 1,
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
await this.axios.get(`/issues`, {
|
||||||
|
params: { state, labels, sort, direction: desc ? 'desc' : 'asc', per_page, page },
|
||||||
|
})
|
||||||
|
).data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateIssue(issue, data) {
|
async updateIssue(issue, data) {
|
||||||
@@ -77,8 +92,8 @@ export default class GithubAPI {
|
|||||||
|
|
||||||
async closeIssue(issue) {
|
async closeIssue(issue) {
|
||||||
return this.updateIssue(issue, {
|
return this.updateIssue(issue, {
|
||||||
state: "closed"
|
state: 'closed',
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async getReleases({ per_page = 30, page = 1 } = {}) {
|
async getReleases({ per_page = 30, page = 1 } = {}) {
|
||||||
@@ -86,7 +101,11 @@ export default class GithubAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getRelease(release = 'latest') {
|
async getRelease(release = 'latest') {
|
||||||
return (await this.axios.get(parseVersion(release) ? `/releases/tags/${release}` : `/releases/${release}`)).data;
|
return (
|
||||||
|
await this.axios.get(
|
||||||
|
parseVersion(release) ? `/releases/tags/${release}` : `/releases/${release}`
|
||||||
|
)
|
||||||
|
).data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getTags({ per_page = 30, page = 1 } = {}) {
|
async getTags({ per_page = 30, page = 1 } = {}) {
|
||||||
@@ -95,23 +114,28 @@ export default class GithubAPI {
|
|||||||
|
|
||||||
async reopenIssue(issue) {
|
async reopenIssue(issue) {
|
||||||
return this.updateIssue(issue, {
|
return this.updateIssue(issue, {
|
||||||
state: "open"
|
state: 'open',
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static async getTagRef(tag) {
|
static async getTagRef(tag) {
|
||||||
try {
|
try {
|
||||||
return (await exec(`git show-ref --tags "refs/tags/${tag}"`)).stdout.split(' ')[0];
|
return (await exec(`git show-ref --tags "refs/tags/${tag}"`)).stdout.split(' ')[0];
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
// Do nothing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static async getLatestTag() {
|
static async getLatestTag() {
|
||||||
try {
|
try {
|
||||||
const {stdout} = await exec(`git for-each-ref refs/tags --sort=-taggerdate --format='%(refname)' --count=1`);
|
const { stdout } = await exec(
|
||||||
|
`git for-each-ref refs/tags --sort=-taggerdate --format='%(refname)' --count=1`
|
||||||
|
);
|
||||||
|
|
||||||
return stdout.split('/').pop();
|
return stdout.split('/').pop();
|
||||||
} catch (e) {}
|
} catch (e) {
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static normalizeTag(tag) {
|
static normalizeTag(tag) {
|
||||||
@@ -121,11 +145,13 @@ export default class GithubAPI {
|
|||||||
|
|
||||||
const { prototype } = GithubAPI;
|
const { prototype } = GithubAPI;
|
||||||
|
|
||||||
['getUser', 'isCollaborator'].forEach(methodName => {
|
['getUser', 'isCollaborator'].forEach((methodName) => {
|
||||||
prototype[methodName] = memoize(prototype[methodName], { promise: true })
|
prototype[methodName] = memoize(prototype[methodName], { promise: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
['get', 'post', 'put', 'delete', 'isAxiosError'].forEach((method) => prototype[method] = function(...args){
|
['get', 'post', 'put', 'delete', 'isAxiosError'].forEach(
|
||||||
|
(method) =>
|
||||||
|
(prototype[method] = function (...args) {
|
||||||
return this.axios[method](...args);
|
return this.axios[method](...args);
|
||||||
});
|
})
|
||||||
|
);
|
||||||
|
|||||||
+25
-20
@@ -1,17 +1,17 @@
|
|||||||
import GithubAPI from "./GithubAPI.js";
|
import GithubAPI from './GithubAPI.js';
|
||||||
import api from './api.js';
|
import api from './api.js';
|
||||||
import Handlebars from "handlebars";
|
import Handlebars from 'handlebars';
|
||||||
import fs from "fs/promises";
|
import fs from 'fs/promises';
|
||||||
import {colorize} from "./helpers/colorize.js";
|
import { colorize } from './helpers/colorize.js';
|
||||||
import {getReleaseInfo} from "./contributors.js";
|
import { getReleaseInfo } from './contributors.js';
|
||||||
import path from "path";
|
import path from 'path';
|
||||||
import {fileURLToPath} from "url";
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
const NOTIFY_PR_TEMPLATE = path.resolve(__dirname, '../templates/pr_published.hbs');
|
const NOTIFY_PR_TEMPLATE = path.resolve(__dirname, '../templates/pr_published.hbs');
|
||||||
|
|
||||||
const normalizeTag = (tag) => tag ? 'v' + tag.replace(/^v/, '') : '';
|
const normalizeTag = (tag) => (tag ? 'v' + tag.replace(/^v/, '') : '');
|
||||||
|
|
||||||
const GITHUB_BOT_LOGIN = 'github-actions[bot]';
|
const GITHUB_BOT_LOGIN = 'github-actions[bot]';
|
||||||
|
|
||||||
@@ -19,14 +19,11 @@ const skipCollaboratorPRs = true;
|
|||||||
|
|
||||||
class RepoBot {
|
class RepoBot {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
const {
|
const { owner, repo, templates } = options || {};
|
||||||
owner, repo,
|
|
||||||
templates
|
|
||||||
} = options || {};
|
|
||||||
|
|
||||||
this.templates = {
|
this.templates = {
|
||||||
published: NOTIFY_PR_TEMPLATE,
|
published: NOTIFY_PR_TEMPLATE,
|
||||||
...templates
|
...templates,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.github = api || new GithubAPI(owner, repo);
|
this.github = api || new GithubAPI(owner, repo);
|
||||||
@@ -54,17 +51,25 @@ class RepoBot {
|
|||||||
|
|
||||||
tag = normalizeTag(tag);
|
tag = normalizeTag(tag);
|
||||||
|
|
||||||
const {merged, labels, user: {login, type}} = pr;
|
const {
|
||||||
|
merged,
|
||||||
|
labels,
|
||||||
|
user: { login, type },
|
||||||
|
} = pr;
|
||||||
|
|
||||||
const isBot = type === 'Bot';
|
const isBot = type === 'Bot';
|
||||||
|
|
||||||
if (!merged) {
|
if (!merged) {
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.github.appendLabels(id, [tag]);
|
await this.github.appendLabels(id, [tag]);
|
||||||
|
|
||||||
if (isBot || labels.find(({name}) => name === 'automated pr') || (skipCollaboratorPRs && await this.github.isCollaborator(login))) {
|
if (
|
||||||
|
isBot ||
|
||||||
|
labels.find(({ name }) => name === 'automated pr') ||
|
||||||
|
(skipCollaboratorPRs && (await this.github.isCollaborator(login)))
|
||||||
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +77,7 @@ class RepoBot {
|
|||||||
|
|
||||||
const comment = comments.find(
|
const comment = comments.find(
|
||||||
({ body, user }) => user.login === GITHUB_BOT_LOGIN && body.indexOf('published in') >= 0
|
({ body, user }) => user.login === GITHUB_BOT_LOGIN && body.indexOf('published in') >= 0
|
||||||
)
|
);
|
||||||
|
|
||||||
if (comment) {
|
if (comment) {
|
||||||
console.log(colorize()`Release comment [${comment.html_url}] already exists in #${pr.id}`);
|
console.log(colorize()`Release comment [${comment.html_url}] already exists in #${pr.id}`);
|
||||||
@@ -88,8 +93,8 @@ class RepoBot {
|
|||||||
author,
|
author,
|
||||||
release: {
|
release: {
|
||||||
tag,
|
tag,
|
||||||
url: `https://github.com/${this.owner}/${this.repo}/releases/tag/${tag}`
|
url: `https://github.com/${this.owner}/${this.repo}/releases/tag/${tag}`,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return await this.addComment(id, message);
|
return await this.addComment(id, message);
|
||||||
@@ -112,7 +117,7 @@ class RepoBot {
|
|||||||
|
|
||||||
for (const pr of merges) {
|
for (const pr of merges) {
|
||||||
try {
|
try {
|
||||||
console.log(colorize()`${i++}) Notify PR #${pr.id}`)
|
console.log(colorize()`${i++}) Notify PR #${pr.id}`);
|
||||||
const result = await this.notifyPRPublished(pr.id, tag);
|
const result = await this.notifyPRPublished(pr.id, tag);
|
||||||
console.log('✔️', result ? 'Label, comment' : 'Label');
|
console.log('✔️', result ? 'Label, comment' : 'Label');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import minimist from "minimist";
|
import minimist from 'minimist';
|
||||||
import RepoBot from '../RepoBot.js';
|
import RepoBot from '../RepoBot.js';
|
||||||
import fs from 'fs/promises';
|
import fs from 'fs/promises';
|
||||||
|
|
||||||
@@ -13,7 +13,6 @@ let { tag } = argv;
|
|||||||
|
|
||||||
tag = 'v' + version;
|
tag = 'v' + version;
|
||||||
} else if (typeof tag !== 'string') {
|
} else if (typeof tag !== 'string') {
|
||||||
|
|
||||||
throw new Error('tag must be a string');
|
throw new Error('tag must be a string');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,4 +24,3 @@ let { tag } = argv;
|
|||||||
console.warn('Error:', err.message);
|
console.warn('Error:', err.message);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
import GithubAPI from "./GithubAPI.js";
|
import GithubAPI from './GithubAPI.js';
|
||||||
|
|
||||||
export default new GithubAPI('axios', 'axios');
|
export default new GithubAPI('axios', 'axios');
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import axiosBuild from '../dist/node/axios.cjs';
|
|||||||
|
|
||||||
const { version } = JSON.parse(fs.readFileSync('./package.json'));
|
const { version } = JSON.parse(fs.readFileSync('./package.json'));
|
||||||
|
|
||||||
console.log('Checking versions...\n----------------------------')
|
console.log('Checking versions...\n----------------------------');
|
||||||
|
|
||||||
console.log(`Package version: v${version}`);
|
console.log(`Package version: v${version}`);
|
||||||
console.log(`Axios version: v${axios.VERSION}`);
|
console.log(`Axios version: v${axios.VERSION}`);
|
||||||
@@ -25,5 +25,3 @@ assert.strictEqual(
|
|||||||
);
|
);
|
||||||
|
|
||||||
console.log('✔️ PASSED\n');
|
console.log('✔️ PASSED\n');
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+48
-42
@@ -1,9 +1,9 @@
|
|||||||
import axios from "./githubAxios.js";
|
import axios from './githubAxios.js';
|
||||||
import util from "util";
|
import util from 'util';
|
||||||
import cp from "child_process";
|
import cp from 'child_process';
|
||||||
import Handlebars from "handlebars";
|
import Handlebars from 'handlebars';
|
||||||
import fs from "fs/promises";
|
import fs from 'fs/promises';
|
||||||
import {colorize} from "./helpers/colorize.js";
|
import { colorize } from './helpers/colorize.js';
|
||||||
|
|
||||||
const exec = util.promisify(cp.exec);
|
const exec = util.promisify(cp.exec);
|
||||||
|
|
||||||
@@ -11,7 +11,8 @@ const ONE_MB = 1024 * 1024;
|
|||||||
|
|
||||||
const removeExtraLineBreaks = (str) => str.replace(/(?:\r\n|\r|\n){3,}/gm, '\r\n\r\n');
|
const removeExtraLineBreaks = (str) => str.replace(/(?:\r\n|\r|\n){3,}/gm, '\r\n\r\n');
|
||||||
|
|
||||||
const cleanTemplate = template => template
|
const cleanTemplate = (template) =>
|
||||||
|
template
|
||||||
.replace(/\n +/g, '\n')
|
.replace(/\n +/g, '\n')
|
||||||
.replace(/^ +/, '')
|
.replace(/^ +/, '')
|
||||||
.replace(/\n\n\n+/g, '\n\n')
|
.replace(/\n\n\n+/g, '\n\n')
|
||||||
@@ -27,13 +28,13 @@ const getUserFromCommit = ((commitCache) => async (sha) => {
|
|||||||
|
|
||||||
const { data } = await axios.get(`https://api.github.com/repos/axios/axios/commits/${sha}`);
|
const { data } = await axios.get(`https://api.github.com/repos/axios/axios/commits/${sha}`);
|
||||||
|
|
||||||
return commitCache[sha] = {
|
return (commitCache[sha] = {
|
||||||
...data.commit.author,
|
...data.commit.author,
|
||||||
...data.author,
|
...data.author,
|
||||||
avatar_url_sm: data.author.avatar_url ? data.author.avatar_url + '&s=18' : '',
|
avatar_url_sm: data.author.avatar_url ? data.author.avatar_url + '&s=18' : '',
|
||||||
};
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return commitCache[sha] = null;
|
return (commitCache[sha] = null);
|
||||||
}
|
}
|
||||||
})({});
|
})({});
|
||||||
|
|
||||||
@@ -45,7 +46,7 @@ const getIssueById = ((cache) => async (id) => {
|
|||||||
try {
|
try {
|
||||||
const { data } = await axios.get(`https://api.github.com/repos/axios/axios/issues/${id}`);
|
const { data } = await axios.get(`https://api.github.com/repos/axios/axios/issues/${id}`);
|
||||||
|
|
||||||
return cache[id] = data;
|
return (cache[id] = data);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -60,10 +61,10 @@ const getUserInfo = ((userCache) => async (userEntry) => {
|
|||||||
|
|
||||||
console.log(colorize()`fetch github user info [${userEntry.name}]`);
|
console.log(colorize()`fetch github user info [${userEntry.name}]`);
|
||||||
|
|
||||||
return userCache[email] = {
|
return (userCache[email] = {
|
||||||
...userEntry,
|
...userEntry,
|
||||||
...await getUserFromCommit(commits[0].hash)
|
...(await getUserFromCommit(commits[0].hash)),
|
||||||
}
|
});
|
||||||
})({});
|
})({});
|
||||||
|
|
||||||
const deduplicate = (authors) => {
|
const deduplicate = (authors) => {
|
||||||
@@ -71,14 +72,14 @@ const deduplicate = (authors) => {
|
|||||||
const combined = {};
|
const combined = {};
|
||||||
|
|
||||||
const assign = (a, b) => {
|
const assign = (a, b) => {
|
||||||
const {insertions, deletions, points, ...rest} = b;
|
const { insertions, _deletions, _points, ...rest } = b;
|
||||||
|
|
||||||
Object.assign(a, rest);
|
Object.assign(a, rest);
|
||||||
|
|
||||||
a.insertions += insertions;
|
a.insertions += insertions;
|
||||||
a.deletions += insertions;
|
a.deletions += insertions;
|
||||||
a.insertions += insertions;
|
a.insertions += insertions;
|
||||||
}
|
};
|
||||||
|
|
||||||
for (const [email, user] of Object.entries(authors)) {
|
for (const [email, user] of Object.entries(authors)) {
|
||||||
const { login } = user;
|
const { login } = user;
|
||||||
@@ -93,7 +94,7 @@ const deduplicate = (authors) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return combined;
|
return combined;
|
||||||
}
|
};
|
||||||
|
|
||||||
const getReleaseInfo = ((releaseCache) => async (tag) => {
|
const getReleaseInfo = ((releaseCache) => async (tag) => {
|
||||||
if (releaseCache[tag] !== undefined) {
|
if (releaseCache[tag] !== undefined) {
|
||||||
@@ -104,9 +105,9 @@ const getReleaseInfo = ((releaseCache) => async (tag) => {
|
|||||||
|
|
||||||
const version = 'v' + tag.replace(/^v/, '');
|
const version = 'v' + tag.replace(/^v/, '');
|
||||||
|
|
||||||
const command = isUnreleasedTag ?
|
const command = isUnreleasedTag
|
||||||
`npx auto-changelog --unreleased-only --stdout --commit-limit false --template json` :
|
? `npx auto-changelog --unreleased-only --stdout --commit-limit false --template json`
|
||||||
`npx auto-changelog ${
|
: `npx auto-changelog ${
|
||||||
version ? '--starting-version ' + version + ' --ending-version ' + version : ''
|
version ? '--starting-version ' + version + ' --ending-version ' + version : ''
|
||||||
} --stdout --commit-limit false --template json`;
|
} --stdout --commit-limit false --template json`;
|
||||||
|
|
||||||
@@ -121,8 +122,8 @@ const getReleaseInfo = ((releaseCache) => async (tag) => {
|
|||||||
|
|
||||||
const commits = [
|
const commits = [
|
||||||
...release.commits,
|
...release.commits,
|
||||||
...release.fixes.map(fix => fix.commit),
|
...release.fixes.map((fix) => fix.commit),
|
||||||
...release.merges.map(fix => fix.commit)
|
...release.merges.map((fix) => fix.commit),
|
||||||
].filter(Boolean);
|
].filter(Boolean);
|
||||||
|
|
||||||
const commitMergeMap = {};
|
const commitMergeMap = {};
|
||||||
@@ -132,12 +133,13 @@ const getReleaseInfo = ((releaseCache) => async (tag) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const { hash, author, email, insertions, deletions } of commits) {
|
for (const { hash, author, email, insertions, deletions } of commits) {
|
||||||
const entry = authors[email] = (authors[email] || {
|
const entry = (authors[email] = authors[email] || {
|
||||||
name: author,
|
name: author,
|
||||||
prs: [],
|
prs: [],
|
||||||
email,
|
email,
|
||||||
commits: [],
|
commits: [],
|
||||||
insertions: 0, deletions: 0
|
insertions: 0,
|
||||||
|
deletions: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
entry.commits.push({ hash });
|
entry.commits.push({ hash });
|
||||||
@@ -160,13 +162,12 @@ const getReleaseInfo = ((releaseCache) => async (tag) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const [email, author] of Object.entries(authors)) {
|
for (const [email, author] of Object.entries(authors)) {
|
||||||
const entry = authors[email] = await getUserInfo(author);
|
const entry = (authors[email] = await getUserInfo(author));
|
||||||
|
|
||||||
entry.isBot = entry.type === "Bot";
|
entry.isBot = entry.type === 'Bot';
|
||||||
}
|
}
|
||||||
|
|
||||||
release.authors = Object.values(deduplicate(authors))
|
release.authors = Object.values(deduplicate(authors)).sort((a, b) => b.points - a.points);
|
||||||
.sort((a, b) => b.points - a.points);
|
|
||||||
|
|
||||||
release.allCommits = commits;
|
release.allCommits = commits;
|
||||||
}
|
}
|
||||||
@@ -179,14 +180,18 @@ const getReleaseInfo = ((releaseCache) => async (tag) => {
|
|||||||
const renderContributorsList = async (tag, template) => {
|
const renderContributorsList = async (tag, template) => {
|
||||||
const release = await getReleaseInfo(tag);
|
const release = await getReleaseInfo(tag);
|
||||||
|
|
||||||
const compile = Handlebars.compile(String(await fs.readFile(template)))
|
const compile = Handlebars.compile(String(await fs.readFile(template)));
|
||||||
|
|
||||||
const content = compile(release);
|
const content = compile(release);
|
||||||
|
|
||||||
return removeExtraLineBreaks(cleanTemplate(content));
|
return removeExtraLineBreaks(cleanTemplate(content));
|
||||||
}
|
};
|
||||||
|
|
||||||
const renderPRsList = async (tag, template, {comments_threshold= 5, awesome_threshold= 5, label = 'add_to_changelog'} = {}) => {
|
const renderPRsList = async (
|
||||||
|
tag,
|
||||||
|
template,
|
||||||
|
{ comments_threshold = 5, awesome_threshold = 5, label = 'add_to_changelog' } = {}
|
||||||
|
) => {
|
||||||
const release = await getReleaseInfo(tag);
|
const release = await getReleaseInfo(tag);
|
||||||
|
|
||||||
const prs = {};
|
const prs = {};
|
||||||
@@ -198,8 +203,13 @@ const renderPRsList = async (tag, template, {comments_threshold= 5, awesome_thre
|
|||||||
const { reactions, body } = pr;
|
const { reactions, body } = pr;
|
||||||
prs[pr.number] = pr;
|
prs[pr.number] = pr;
|
||||||
pr.isHot = pr.comments > comments_threshold;
|
pr.isHot = pr.comments > comments_threshold;
|
||||||
const points = reactions['+1'] +
|
const points =
|
||||||
reactions['hooray'] + reactions['rocket'] + reactions['heart'] + reactions['laugh'] - reactions['-1'];
|
reactions['+1'] +
|
||||||
|
reactions['hooray'] +
|
||||||
|
reactions['rocket'] +
|
||||||
|
reactions['heart'] +
|
||||||
|
reactions['laugh'] -
|
||||||
|
reactions['-1'];
|
||||||
|
|
||||||
pr.isAwesome = points > awesome_threshold;
|
pr.isAwesome = points > awesome_threshold;
|
||||||
|
|
||||||
@@ -219,23 +229,19 @@ const renderPRsList = async (tag, template, {comments_threshold= 5, awesome_thre
|
|||||||
|
|
||||||
release.prs = Object.values(prs);
|
release.prs = Object.values(prs);
|
||||||
|
|
||||||
const compile = Handlebars.compile(String(await fs.readFile(template)))
|
const compile = Handlebars.compile(String(await fs.readFile(template)));
|
||||||
|
|
||||||
const content = compile(release);
|
const content = compile(release);
|
||||||
|
|
||||||
return removeExtraLineBreaks(cleanTemplate(content));
|
return removeExtraLineBreaks(cleanTemplate(content));
|
||||||
}
|
};
|
||||||
|
|
||||||
const getTagRef = async (tag) => {
|
const getTagRef = async (tag) => {
|
||||||
try {
|
try {
|
||||||
return (await exec(`git show-ref --tags "refs/tags/${tag}"`)).stdout.split(' ')[0];
|
return (await exec(`git show-ref --tags "refs/tags/${tag}"`)).stdout.split(' ')[0];
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
// Do nothing
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export {
|
export { renderContributorsList, getReleaseInfo, renderPRsList, getTagRef };
|
||||||
renderContributorsList,
|
|
||||||
getReleaseInfo,
|
|
||||||
renderPRsList,
|
|
||||||
getTagRef
|
|
||||||
}
|
|
||||||
|
|||||||
+11
-6
@@ -1,5 +1,5 @@
|
|||||||
import axios from '../index.js';
|
import axios from '../index.js';
|
||||||
import {colorize} from "./helpers/colorize.js";
|
import { colorize } from './helpers/colorize.js';
|
||||||
|
|
||||||
const { GITHUB_TOKEN } = process.env;
|
const { GITHUB_TOKEN } = process.env;
|
||||||
|
|
||||||
@@ -8,12 +8,17 @@ GITHUB_TOKEN ? console.log(`[GITHUB_TOKEN OK]`) : console.warn(`[GITHUB_TOKEN is
|
|||||||
const defaultTransform = axios.defaults.transformRequest;
|
const defaultTransform = axios.defaults.transformRequest;
|
||||||
|
|
||||||
export default axios.create({
|
export default axios.create({
|
||||||
transformRequest: [defaultTransform[0], function (data) {
|
transformRequest: [
|
||||||
console.log(colorize()`[${this.method.toUpperCase()}] Request [${new URL(axios.getUri(this)).pathname}]`);
|
defaultTransform[0],
|
||||||
|
function (data) {
|
||||||
|
console.log(
|
||||||
|
colorize()`[${this.method.toUpperCase()}] Request [${new URL(axios.getUri(this)).pathname}]`
|
||||||
|
);
|
||||||
return data;
|
return data;
|
||||||
}],
|
},
|
||||||
|
],
|
||||||
baseURL: 'https://api.github.com/',
|
baseURL: 'https://api.github.com/',
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: GITHUB_TOKEN ? `token ${GITHUB_TOKEN}` : null
|
Authorization: GITHUB_TOKEN ? `token ${GITHUB_TOKEN}` : null,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ export const colorize = (...colors) => {
|
|||||||
|
|
||||||
return (strings, ...values) => {
|
return (strings, ...values) => {
|
||||||
const { length } = values;
|
const { length } = values;
|
||||||
return strings.map((str, i) => i < length ? str + chalk[colors[i%colorsCount]].bold(values[i]) : str).join('');
|
return strings
|
||||||
}
|
.map((str, i) => (i < length ? str + chalk[colors[i % colorsCount]].bold(values[i]) : str))
|
||||||
}
|
.join('');
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
export const matchAll = (text, regexp, cb) => {
|
export const matchAll = (text, regexp, cb) => {
|
||||||
let match;
|
let match;
|
||||||
|
|
||||||
while ((match = regexp.exec(text))) {
|
while ((match = regexp.exec(text))) {
|
||||||
cb(match);
|
cb(match);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export const parseSection = (body, name, cb) => {
|
export const parseSection = (body, name, cb) => {
|
||||||
matchAll(body, new RegExp(`^(#+)\\s+${name}?(.*?)^\\1\\s+\\w+`, 'gims'), cb);
|
matchAll(body, new RegExp(`^(#+)\\s+${name}?(.*?)^\\1\\s+\\w+`, 'gims'), cb);
|
||||||
}
|
};
|
||||||
|
|
||||||
export const parseVersion = (rawVersion) => /^v?(\d+).(\d+).(\d+)/.exec(rawVersion);
|
export const parseVersion = (rawVersion) => /^v?(\d+).(\d+).(\d+)/.exec(rawVersion);
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import fs from 'fs/promises';
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { renderContributorsList, getTagRef, renderPRsList } from './contributors.js';
|
import { renderContributorsList, getTagRef, renderPRsList } from './contributors.js';
|
||||||
import asyncReplace from 'string-replace-async';
|
import asyncReplace from 'string-replace-async';
|
||||||
import {fileURLToPath} from "url";
|
import { fileURLToPath } from 'url';
|
||||||
import {colorize} from "./helpers/colorize.js";
|
import { colorize } from './helpers/colorize.js';
|
||||||
|
|
||||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ const injectSection = async (name, contributorsRE, injector, infile = '../CHANGE
|
|||||||
infile = path.resolve(__dirname, infile);
|
infile = path.resolve(__dirname, infile);
|
||||||
|
|
||||||
const content = String(await fs.readFile(infile));
|
const content = String(await fs.readFile(infile));
|
||||||
const headerRE = /^#+\s+\[([-_\d.\w]+)].+?$/mig;
|
const headerRE = /^#+\s+\[([-_\d.\w]+)].+?$/gim;
|
||||||
|
|
||||||
let tag;
|
let tag;
|
||||||
let index = 0;
|
let index = 0;
|
||||||
@@ -36,7 +36,7 @@ const injectSection = async (name, contributorsRE, injector, infile = '../CHANGE
|
|||||||
if (hasSection) {
|
if (hasSection) {
|
||||||
console.log(colorize()`[${currentTag}]: ✓ OK`);
|
console.log(colorize()`[${currentTag}]: ✓ OK`);
|
||||||
} else {
|
} else {
|
||||||
const target = isFirstTag && (!await getTagRef(currentTag)) ? '' : currentTag;
|
const target = isFirstTag && !(await getTagRef(currentTag)) ? '' : currentTag;
|
||||||
|
|
||||||
console.log(colorize()`[${currentTag}]: ❌ MISSED` + (!target ? ' (UNRELEASED)' : ''));
|
console.log(colorize()`[${currentTag}]: ❌ MISSED` + (!target ? ' (UNRELEASED)' : ''));
|
||||||
|
|
||||||
@@ -63,16 +63,12 @@ const injectSection = async (name, contributorsRE, injector, infile = '../CHANGE
|
|||||||
});
|
});
|
||||||
|
|
||||||
await fs.writeFile(infile, newContent);
|
await fs.writeFile(infile, newContent);
|
||||||
}
|
};
|
||||||
|
|
||||||
await injectSection(
|
await injectSection('PRs', /^\s*### PRs/im, (tag) =>
|
||||||
'PRs',
|
tag ? '' : renderPRsList(tag, PRS_TEMPLATE, { awesome_threshold: 5, comments_threshold: 7 })
|
||||||
/^\s*### PRs/mi,
|
|
||||||
(tag) => tag ? '' : renderPRsList(tag, PRS_TEMPLATE, {awesome_threshold: 5, comments_threshold: 7}),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
await injectSection(
|
await injectSection('contributors', /^\s*### Contributors/im, (tag) =>
|
||||||
'contributors',
|
renderContributorsList(tag, CONTRIBUTORS_TEMPLATE)
|
||||||
/^\s*### Contributors/mi,
|
|
||||||
(tag) => renderContributorsList(tag, CONTRIBUTORS_TEMPLATE)
|
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import Handlebars from "handlebars";
|
import Handlebars from 'handlebars';
|
||||||
import fs from "fs/promises";
|
import fs from 'fs/promises';
|
||||||
import prettyBytes from 'pretty-bytes';
|
import prettyBytes from 'pretty-bytes';
|
||||||
import { getBlobHistory } from './repo.js';
|
import { getBlobHistory } from './repo.js';
|
||||||
import pacote from "pacote";
|
import pacote from 'pacote';
|
||||||
import zlib from "zlib";
|
import zlib from 'zlib';
|
||||||
import tar from "tar-stream";
|
import tar from 'tar-stream';
|
||||||
import { Readable } from "stream";
|
import { Readable } from 'stream';
|
||||||
|
|
||||||
const FILE_SIZE_DIFF_THRESHOLD = 512; // 0.5KB
|
const FILE_SIZE_DIFF_THRESHOLD = 512; // 0.5KB
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ const {version} = await readJSONFile('./package.json');
|
|||||||
const parseVersion = (tag) => {
|
const parseVersion = (tag) => {
|
||||||
const [, major, minor, patch] = /^v?(\d+)\.(\d+)\.(\d+)/.exec(tag) || [];
|
const [, major, minor, patch] = /^v?(\d+)\.(\d+)\.(\d+)/.exec(tag) || [];
|
||||||
return [major, minor, patch];
|
return [major, minor, patch];
|
||||||
}
|
};
|
||||||
|
|
||||||
const [MAJOR_NUMBER] = parseVersion(version);
|
const [MAJOR_NUMBER] = parseVersion(version);
|
||||||
|
|
||||||
@@ -27,14 +27,14 @@ async function getFilesFromNPM(pkg) {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const extract = tar.extract();
|
const extract = tar.extract();
|
||||||
|
|
||||||
extract.on("entry", (header, stream, next) => {
|
extract.on('entry', (header, stream, next) => {
|
||||||
const buffers = [];
|
const buffers = [];
|
||||||
|
|
||||||
stream.on('data', (buffer) => {
|
stream.on('data', (buffer) => {
|
||||||
buffers.push(buffer);
|
buffers.push(buffer);
|
||||||
});
|
});
|
||||||
|
|
||||||
stream.on("end", () => {
|
stream.on('end', () => {
|
||||||
const content = Buffer.concat(buffers);
|
const content = Buffer.concat(buffers);
|
||||||
|
|
||||||
const gzipped = zlib.gzipSync(content);
|
const gzipped = zlib.gzipSync(content);
|
||||||
@@ -42,7 +42,7 @@ async function getFilesFromNPM(pkg) {
|
|||||||
files[header.name.replace(/^package\//, '')] = {
|
files[header.name.replace(/^package\//, '')] = {
|
||||||
gzip: gzipped.length,
|
gzip: gzipped.length,
|
||||||
compressed: header.size ? gzipped.length / header.size : 1,
|
compressed: header.size ? gzipped.length / header.size : 1,
|
||||||
...header
|
...header,
|
||||||
};
|
};
|
||||||
|
|
||||||
next();
|
next();
|
||||||
@@ -52,14 +52,11 @@ async function getFilesFromNPM(pkg) {
|
|||||||
Readable.from(tgzData)
|
Readable.from(tgzData)
|
||||||
.pipe(zlib.createGunzip())
|
.pipe(zlib.createGunzip())
|
||||||
.pipe(extract)
|
.pipe(extract)
|
||||||
.on("error", reject)
|
.on('error', reject)
|
||||||
.on('finish', () => resolve(files));
|
.on('finish', () => resolve(files));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const generateFileReport = async (files, historyCount = 3) => {
|
const generateFileReport = async (files, historyCount = 3) => {
|
||||||
const allFilesStat = {};
|
const allFilesStat = {};
|
||||||
const commits = (await getBlobHistory('package.json', historyCount)).filter(({ tag }) => {
|
const commits = (await getBlobHistory('package.json', historyCount)).filter(({ tag }) => {
|
||||||
@@ -69,15 +66,18 @@ const generateFileReport = async (files, historyCount = 3) => {
|
|||||||
|
|
||||||
const npmHistory = {};
|
const npmHistory = {};
|
||||||
|
|
||||||
await Promise.all(commits.map(async ({tag}) => {
|
await Promise.all(
|
||||||
|
commits.map(async ({ tag }) => {
|
||||||
npmHistory[tag] = await getFilesFromNPM(`axios@${tag.replace(/^v/, '')}`);
|
npmHistory[tag] = await getFilesFromNPM(`axios@${tag.replace(/^v/, '')}`);
|
||||||
}));
|
})
|
||||||
|
);
|
||||||
|
|
||||||
for (const [name, filename] of Object.entries(files)) {
|
for (const [name, filename] of Object.entries(files)) {
|
||||||
const file = await fs.stat(filename).catch(console.warn);
|
const file = await fs.stat(filename).catch(console.warn);
|
||||||
const gzip = file ? zlib.gzipSync(await fs.readFile(filename)).length : 0;
|
const gzip = file ? zlib.gzipSync(await fs.readFile(filename)).length : 0;
|
||||||
|
|
||||||
const stat = allFilesStat[filename] = file ? {
|
const stat = (allFilesStat[filename] = file
|
||||||
|
? {
|
||||||
name,
|
name,
|
||||||
size: file.size,
|
size: file.size,
|
||||||
path: filename,
|
path: filename,
|
||||||
@@ -85,16 +85,15 @@ const generateFileReport = async (files, historyCount = 3) => {
|
|||||||
compressed: file.size ? gzip / file.size : 1,
|
compressed: file.size ? gzip / file.size : 1,
|
||||||
history: commits.map(({ tag }) => {
|
history: commits.map(({ tag }) => {
|
||||||
const files = npmHistory[tag];
|
const files = npmHistory[tag];
|
||||||
const file = files && files[filename] || null;
|
const file = (files && files[filename]) || null;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
tag,
|
tag,
|
||||||
...file
|
...file,
|
||||||
};
|
};
|
||||||
})
|
}),
|
||||||
} : null;
|
}
|
||||||
|
: null);
|
||||||
|
|
||||||
|
|
||||||
if (stat.history[0]) {
|
if (stat.history[0]) {
|
||||||
const diff = stat.gzip - stat.history[0].gzip;
|
const diff = stat.gzip - stat.history[0].gzip;
|
||||||
@@ -113,22 +112,28 @@ const generateFileReport = async (files, historyCount = 3) => {
|
|||||||
return {
|
return {
|
||||||
version,
|
version,
|
||||||
files: allFilesStat,
|
files: allFilesStat,
|
||||||
warns
|
warns,
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
const generateBody = async ({ files, template = './templates/pr.hbs' } = {}) => {
|
const generateBody = async ({ files, template = './templates/pr.hbs' } = {}) => {
|
||||||
const data = await generateFileReport(files);
|
const data = await generateFileReport(files);
|
||||||
|
|
||||||
Handlebars.registerHelper('filesize', (bytes) => bytes != null ? prettyBytes(bytes) : '<unknown>');
|
Handlebars.registerHelper('filesize', (bytes) =>
|
||||||
Handlebars.registerHelper('percent', (value) => Number.isFinite(value) ? `${(value * 100).toFixed(1)}%` : `---` );
|
bytes != null ? prettyBytes(bytes) : '<unknown>'
|
||||||
|
);
|
||||||
|
Handlebars.registerHelper('percent', (value) =>
|
||||||
|
Number.isFinite(value) ? `${(value * 100).toFixed(1)}%` : `---`
|
||||||
|
);
|
||||||
|
|
||||||
return Handlebars.compile(String(await fs.readFile(template)))(data);
|
return Handlebars.compile(String(await fs.readFile(template)))(data);
|
||||||
}
|
};
|
||||||
|
|
||||||
console.log(await generateBody({
|
console.log(
|
||||||
|
await generateBody({
|
||||||
files: {
|
files: {
|
||||||
'Browser build (UMD)': 'dist/axios.min.js',
|
'Browser build (UMD)': 'dist/axios.min.js',
|
||||||
'Browser build (ESM)': 'dist/esm/axios.min.js',
|
'Browser build (ESM)': 'dist/esm/axios.min.js',
|
||||||
}
|
},
|
||||||
}));
|
})
|
||||||
|
);
|
||||||
|
|||||||
+13
-15
@@ -1,20 +1,20 @@
|
|||||||
import util from "util";
|
import util from 'util';
|
||||||
import cp from "child_process";
|
import cp from 'child_process';
|
||||||
|
|
||||||
export const exec = util.promisify(cp.exec);
|
export const exec = util.promisify(cp.exec);
|
||||||
|
|
||||||
export const getBlobSize = async (filepath, sha = 'HEAD') => {
|
export const getBlobSize = async (filepath, sha = 'HEAD') => {
|
||||||
const size = (await exec(
|
const size = (await exec(`git cat-file -s ${sha}:${filepath}`)).stdout;
|
||||||
`git cat-file -s ${sha}:${filepath}`
|
|
||||||
)).stdout;
|
|
||||||
|
|
||||||
return size ? +size : 0;
|
return size ? +size : 0;
|
||||||
}
|
};
|
||||||
|
|
||||||
export const getBlobHistory = async (filepath, maxCount = 5) => {
|
export const getBlobHistory = async (filepath, maxCount = 5) => {
|
||||||
const log = (await exec(
|
const log = (
|
||||||
|
await exec(
|
||||||
`git log --max-count=${maxCount} --no-walk --tags=v* --oneline --format=%H%d -- ${filepath}`
|
`git log --max-count=${maxCount} --no-walk --tags=v* --oneline --format=%H%d -- ${filepath}`
|
||||||
)).stdout;
|
)
|
||||||
|
).stdout;
|
||||||
|
|
||||||
const commits = [];
|
const commits = [];
|
||||||
|
|
||||||
@@ -26,17 +26,15 @@ export const getBlobHistory = async (filepath, maxCount= 5) => {
|
|||||||
commits.push({
|
commits.push({
|
||||||
sha: match[1],
|
sha: match[1],
|
||||||
tag: match[2],
|
tag: match[2],
|
||||||
size: await getBlobSize(filepath, match[1])
|
size: await getBlobSize(filepath, match[1]),
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return commits;
|
return commits;
|
||||||
}
|
};
|
||||||
|
|
||||||
export const getTags = async (pattern = 'v*', sort = '-v:refname') => {
|
export const getTags = async (pattern = 'v*', sort = '-v:refname') => {
|
||||||
const log = (await exec(
|
const log = (await exec(`git tag -l ${pattern} --sort=${sort}`)).stdout;
|
||||||
`git tag -l ${pattern} --sort=${sort}`
|
|
||||||
)).stdout;
|
|
||||||
|
|
||||||
return log.split(/\r?\n/);
|
return log.split(/\r?\n/);
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import {exec, getTags} from "./repo.js";
|
import { exec, getTags } from './repo.js';
|
||||||
import fs from "fs";
|
import fs from 'fs';
|
||||||
import {colorize} from "./helpers/colorize.js";
|
import { colorize } from './helpers/colorize.js';
|
||||||
|
|
||||||
const { version } = JSON.parse(fs.readFileSync('./package.json'));
|
const { version } = JSON.parse(fs.readFileSync('./package.json'));
|
||||||
|
|
||||||
@@ -13,6 +13,8 @@ const isLatest = latestTag === version;
|
|||||||
|
|
||||||
let tag = isBeta ? 'next' : isLatest ? 'latest' : `v${major}`;
|
let tag = isBeta ? 'next' : isLatest ? 'latest' : `v${major}`;
|
||||||
|
|
||||||
console.log(colorize()`Version [${version}] [${isBeta ? 'prerelease' : 'release'}] latest [${latestTag}]=> NPM Tag [${tag}]`);
|
console.log(
|
||||||
|
colorize()`Version [${version}] [${isBeta ? 'prerelease' : 'release'}] latest [${latestTag}]=> NPM Tag [${tag}]`
|
||||||
|
);
|
||||||
|
|
||||||
await exec(`echo "tag=${tag}" >> $GITHUB_OUTPUT`);
|
await exec(`echo "tag=${tag}" >> $GITHUB_OUTPUT`);
|
||||||
|
|||||||
+2
-11
@@ -1,11 +1,10 @@
|
|||||||
import { startTestServer, stopHTTPServer } from '../test/helpers/server.js';
|
import { startTestServer, stopHTTPServer } from '../test/helpers/server.js';
|
||||||
import { spawn } from 'child_process';
|
import { spawn } from 'child_process';
|
||||||
import chalk from "chalk";
|
import chalk from 'chalk';
|
||||||
|
|
||||||
let server;
|
let server;
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
|
|
||||||
console.log(chalk.red.bold(`[ Starting HTTP server... ]`));
|
console.log(chalk.red.bold(`[ Starting HTTP server... ]`));
|
||||||
|
|
||||||
server = await startTestServer(3000);
|
server = await startTestServer(3000);
|
||||||
@@ -13,10 +12,7 @@ async function run() {
|
|||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
console.log('Starting karma runner...');
|
console.log('Starting karma runner...');
|
||||||
|
|
||||||
const karma = spawn(
|
const karma = spawn('npx', ['karma', 'start', 'karma.conf.cjs', '--single-run'], {
|
||||||
'npx',
|
|
||||||
['karma', 'start', 'karma.conf.cjs', '--single-run'],
|
|
||||||
{
|
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
shell: true,
|
shell: true,
|
||||||
env: { ...process.env, LISTEN_ADDR: '0.0.0.0' },
|
env: { ...process.env, LISTEN_ADDR: '0.0.0.0' },
|
||||||
@@ -26,11 +22,8 @@ async function run() {
|
|||||||
code ? reject(new Error(`Karma tests failed with exit code ${code}`)) : resolve();
|
code ? reject(new Error(`Karma tests failed with exit code ${code}`)) : resolve();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
await run();
|
await run();
|
||||||
@@ -42,5 +35,3 @@ async function run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+15
-25
@@ -1,12 +1,12 @@
|
|||||||
import fs from "fs/promises";
|
import fs from 'fs/promises';
|
||||||
import _axios from "../index.js";
|
import _axios from '../index.js';
|
||||||
import { exec } from "./repo.js";
|
import { exec } from './repo.js';
|
||||||
import { colorize } from "./helpers/colorize.js";
|
import { colorize } from './helpers/colorize.js';
|
||||||
|
|
||||||
const axios = _axios.create({
|
const axios = _axios.create({
|
||||||
headers: {
|
headers: {
|
||||||
"User-Agent":
|
'User-Agent':
|
||||||
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
|
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -19,9 +19,7 @@ const getWithRetry = (url, retries = 3) => {
|
|||||||
if (counter++ >= retries) {
|
if (counter++ >= retries) {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
await new Promise((resolve) =>
|
await new Promise((resolve) => setTimeout(resolve, counter ** counter * 1000));
|
||||||
setTimeout(resolve, counter ** counter * 1000),
|
|
||||||
);
|
|
||||||
return doRequest();
|
return doRequest();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -29,11 +27,7 @@ const getWithRetry = (url, retries = 3) => {
|
|||||||
return doRequest();
|
return doRequest();
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateReadmeSponsors = async (
|
const updateReadmeSponsors = async (url, path, marker = '<!--<div>marker</div>-->') => {
|
||||||
url,
|
|
||||||
path,
|
|
||||||
marker = "<!--<div>marker</div>-->",
|
|
||||||
) => {
|
|
||||||
let fileContent = (await fs.readFile(path)).toString();
|
let fileContent = (await fs.readFile(path)).toString();
|
||||||
|
|
||||||
const index = fileContent.indexOf(marker);
|
const index = fileContent.indexOf(marker);
|
||||||
@@ -42,7 +36,7 @@ const updateReadmeSponsors = async (
|
|||||||
const readmeContent = fileContent.slice(index);
|
const readmeContent = fileContent.slice(index);
|
||||||
|
|
||||||
let { data: sponsorContent } = await getWithRetry(url);
|
let { data: sponsorContent } = await getWithRetry(url);
|
||||||
sponsorContent += "\n";
|
sponsorContent += '\n';
|
||||||
|
|
||||||
const currentSponsorContent = fileContent.slice(0, index);
|
const currentSponsorContent = fileContent.slice(0, index);
|
||||||
|
|
||||||
@@ -54,22 +48,18 @@ const updateReadmeSponsors = async (
|
|||||||
console.log(colorize()`Sponsor block in [${path}] is up to date`);
|
console.log(colorize()`Sponsor block in [${path}] is up to date`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.warn(
|
console.warn(colorize()`Can not find marker (${marker}) in ${path} to inject sponsor block`);
|
||||||
colorize()`Can not find marker (${marker}) in ${path} to inject sponsor block`,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
(async (url) => {
|
(async (url) => {
|
||||||
const newContent = await updateReadmeSponsors(url, "./README.md");
|
const newContent = await updateReadmeSponsors(url, './README.md');
|
||||||
|
|
||||||
await exec(
|
await exec(`echo "changed=${newContent ? 'true' : 'false'}" >> $GITHUB_OUTPUT`);
|
||||||
`echo "changed=${newContent ? "true" : "false"}" >> $GITHUB_OUTPUT`,
|
|
||||||
);
|
|
||||||
if (newContent !== false) {
|
if (newContent !== false) {
|
||||||
await fs.mkdir("./temp").catch(() => {});
|
await fs.mkdir('./temp').catch(() => {});
|
||||||
await fs.writeFile("./temp/sponsors.md", newContent);
|
await fs.writeFile('./temp/sponsors.md', newContent);
|
||||||
}
|
}
|
||||||
})("https://axios-http.com/data/sponsors.md");
|
})('https://axios-http.com/data/sponsors.md');
|
||||||
|
|||||||
+7
-5
@@ -10,13 +10,15 @@ const isHotfixNeeded = match && match[1] > 16;
|
|||||||
|
|
||||||
isHotfixNeeded && console.warn('Setting --openssl-legacy-provider as ssl hotfix');
|
isHotfixNeeded && console.warn('Setting --openssl-legacy-provider as ssl hotfix');
|
||||||
|
|
||||||
const test = spawn('cross-env',
|
const test = spawn(
|
||||||
isHotfixNeeded ? ['NODE_OPTIONS=--openssl-legacy-provider', ...args] : args, {
|
'cross-env',
|
||||||
|
isHotfixNeeded ? ['NODE_OPTIONS=--openssl-legacy-provider', ...args] : args,
|
||||||
|
{
|
||||||
shell: true,
|
shell: true,
|
||||||
stdio: 'inherit'
|
stdio: 'inherit',
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
test.on('exit', function (code) {
|
test.on('exit', function (code) {
|
||||||
process.exit(code)
|
process.exit(code);
|
||||||
})
|
});
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<title>axios - abort controller example</title>
|
<title>axios - abort controller example</title>
|
||||||
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" />
|
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" />
|
||||||
<style>
|
<style>
|
||||||
.status { margin-top: 10px; }
|
.status {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="container">
|
<body class="container">
|
||||||
<h1>axios.AbortController</h1>
|
<h1>axios.AbortController</h1>
|
||||||
|
|
||||||
@@ -129,4 +133,5 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -6,11 +6,13 @@ export default function (req, res) {
|
|||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
res.writeHead(200, {
|
res.writeHead(200, {
|
||||||
'Content-Type': 'text/json'
|
'Content-Type': 'text/json',
|
||||||
});
|
});
|
||||||
res.write(JSON.stringify({
|
res.write(
|
||||||
message: 'Response completed successfully after ' + delay + 'ms'
|
JSON.stringify({
|
||||||
}));
|
message: 'Response completed successfully after ' + delay + 'ms',
|
||||||
|
})
|
||||||
|
);
|
||||||
res.end();
|
res.end();
|
||||||
}, delay);
|
}, delay);
|
||||||
};
|
}
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<title>axios - all example</title>
|
<title>axios - all example</title>
|
||||||
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" />
|
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="container">
|
<body class="container">
|
||||||
<h1>axios.all</h1>
|
<h1>axios.all</h1>
|
||||||
|
|
||||||
@@ -41,4 +43,5 @@
|
|||||||
}));
|
}));
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<title>AMD</title>
|
<title>AMD</title>
|
||||||
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" />
|
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="container">
|
<body class="container">
|
||||||
<h1>AMD</h1>
|
<h1>AMD</h1>
|
||||||
|
|
||||||
@@ -34,4 +36,5 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<title>axios - get example</title>
|
<title>axios - get example</title>
|
||||||
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" />
|
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="container">
|
<body class="container">
|
||||||
<h1>axios.get</h1>
|
<h1>axios.get</h1>
|
||||||
<ul id="people" class="list-unstyled"></ul>
|
<ul id="people" class="list-unstyled"></ul>
|
||||||
@@ -18,8 +20,8 @@
|
|||||||
'<img src="https://avatars.githubusercontent.com/u/' + person.avatar + '?s=50" class="col-md-1"/>' +
|
'<img src="https://avatars.githubusercontent.com/u/' + person.avatar + '?s=50" class="col-md-1"/>' +
|
||||||
'<div class="col-md-3">' +
|
'<div class="col-md-3">' +
|
||||||
'<strong>' + person.name + '</strong>' +
|
'<strong>' + person.name + '</strong>' +
|
||||||
'<div>GitHub: <a href="https://github.com/' + person.github + '" target="_blank">' + person.github + '</a></div>' +
|
'<div>GitHub: <a href="https://github.com/' + person.github + '" target="_blank" rel="noopener noreferrer">' + person.github + '</a></div>' +
|
||||||
'<div>Twitter: <a href="https://twitter.com/' + person.twitter + '" target="_blank">' + person.twitter + '</a></div>' +
|
'<div>Twitter: <a href="https://twitter.com/' + person.twitter + '" target="_blank" rel="noopener noreferrer">' + person.twitter + '</a></div>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'</li><br/>'
|
'</li><br/>'
|
||||||
);
|
);
|
||||||
@@ -30,4 +32,5 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
+19
-19
@@ -1,34 +1,34 @@
|
|||||||
const people = [
|
const people = [
|
||||||
{
|
{
|
||||||
"name": "Matt Zabriskie",
|
name: 'Matt Zabriskie',
|
||||||
"github": "mzabriskie",
|
github: 'mzabriskie',
|
||||||
"twitter": "mzabriskie",
|
twitter: 'mzabriskie',
|
||||||
"avatar": "199035"
|
avatar: '199035',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Ryan Florence",
|
name: 'Ryan Florence',
|
||||||
"github": "rpflorence",
|
github: 'rpflorence',
|
||||||
"twitter": "ryanflorence",
|
twitter: 'ryanflorence',
|
||||||
"avatar": "100200"
|
avatar: '100200',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Kent C. Dodds",
|
name: 'Kent C. Dodds',
|
||||||
"github": "kentcdodds",
|
github: 'kentcdodds',
|
||||||
"twitter": "kentcdodds",
|
twitter: 'kentcdodds',
|
||||||
"avatar": "1500684"
|
avatar: '1500684',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Chris Esplin",
|
name: 'Chris Esplin',
|
||||||
"github": "deltaepsilon",
|
github: 'deltaepsilon',
|
||||||
"twitter": "chrisesplin",
|
twitter: 'chrisesplin',
|
||||||
"avatar": "878947"
|
avatar: '878947',
|
||||||
}
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export default function (req, res) {
|
export default function (req, res) {
|
||||||
res.writeHead(200, {
|
res.writeHead(200, {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json',
|
||||||
});
|
});
|
||||||
res.write(JSON.stringify(people));
|
res.write(JSON.stringify(people));
|
||||||
res.end();
|
res.end();
|
||||||
};
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ Our approach adds clear, categorised error messages for different network issues
|
|||||||
|
|
||||||
==> Problem
|
==> Problem
|
||||||
Axios currently throws the same `Network Error` message for many different cases:
|
Axios currently throws the same `Network Error` message for many different cases:
|
||||||
|
|
||||||
- The Internet is disconnected
|
- The Internet is disconnected
|
||||||
- DNS lookup fails
|
- DNS lookup fails
|
||||||
- Server is down or refusing connections
|
- Server is down or refusing connections
|
||||||
@@ -18,10 +19,10 @@ Axios currently throws the same `Network Error` message for many different cases
|
|||||||
|
|
||||||
These cases all look the same to developers and users, making debugging harder.
|
These cases all look the same to developers and users, making debugging harder.
|
||||||
|
|
||||||
|
|
||||||
--> Our Approach — Wrapper / Middleware
|
--> Our Approach — Wrapper / Middleware
|
||||||
|
|
||||||
We created a small wrapper function called `enhanceNetworkError()` that:
|
We created a small wrapper function called `enhanceNetworkError()` that:
|
||||||
|
|
||||||
- Detects Common network problems using `error.code`, `error.message`, and response status.
|
- Detects Common network problems using `error.code`, `error.message`, and response status.
|
||||||
- Adds a new field `error.detailedMessage` with a short, clear explanation.
|
- Adds a new field `error.detailedMessage` with a short, clear explanation.
|
||||||
- Assigns a new `error.code` (like `ERR_TIMEOUT`, `ERR_DNS_FAILURE`, etc.).
|
- Assigns a new `error.code` (like `ERR_TIMEOUT`, `ERR_DNS_FAILURE`, etc.).
|
||||||
@@ -42,15 +43,15 @@ The wrapper is used inside an Axios instance via a Response interceptor.
|
|||||||
- Other → `ERR_NETWORK_GENERIC`
|
- Other → `ERR_NETWORK_GENERIC`
|
||||||
3. It returns a more descriptive error with both `code` and `detailedMessage`.
|
3. It returns a more descriptive error with both `code` and `detailedMessage`.
|
||||||
|
|
||||||
|
|
||||||
-> Example Usage
|
-> Example Usage
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const api = createEnhancedClient({ baseURL: 'https://example.com' });
|
const api = createEnhancedClient({ baseURL: 'https://example.com' });
|
||||||
|
|
||||||
api.get('/data')
|
api
|
||||||
.then(res => console.log(res.data))
|
.get('/data')
|
||||||
.catch(err => {
|
.then((res) => console.log(res.data))
|
||||||
|
.catch((err) => {
|
||||||
console.error(err.code); // e.g., ERR_TIMEOUT
|
console.error(err.code); // e.g., ERR_TIMEOUT
|
||||||
console.error(err.detailedMessage); // e.g., "The request took too long to respond."
|
console.error(err.detailedMessage); // e.g., "The request took too long to respond."
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -25,29 +25,25 @@ function enhanceNetworkError(error) {
|
|||||||
// when Request timeout happens
|
// when Request timeout happens
|
||||||
else if (error.code === 'ETIMEDOUT' || /timeout/i.test(error.message)) {
|
else if (error.code === 'ETIMEDOUT' || /timeout/i.test(error.message)) {
|
||||||
error.code = 'ERR_TIMEOUT';
|
error.code = 'ERR_TIMEOUT';
|
||||||
error.detailedMessage =
|
error.detailedMessage = 'The request took too long to respond. Please try again later.';
|
||||||
'The request took too long to respond. Please try again later.';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// when CORS restriction happens (for browser only)
|
// when CORS restriction happens (for browser only)
|
||||||
else if (/CORS/i.test(error.message)) {
|
else if (/CORS/i.test(error.message)) {
|
||||||
error.code = 'ERR_CORS_BLOCKED';
|
error.code = 'ERR_CORS_BLOCKED';
|
||||||
error.detailedMessage =
|
error.detailedMessage = 'The request was blocked due to cross-origin restrictions.';
|
||||||
'The request was blocked due to cross-origin restrictions.';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// when Server-side error occurs
|
// when Server-side error occurs
|
||||||
else if (error.response && error.response.status >= 500) {
|
else if (error.response && error.response.status >= 500) {
|
||||||
error.code = 'ERR_SERVER';
|
error.code = 'ERR_SERVER';
|
||||||
error.detailedMessage =
|
error.detailedMessage = 'A server-side issue occurred. Please try again later.';
|
||||||
'A server-side issue occurred. Please try again later.';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// when Client-side error occurs
|
// when Client-side error occurs
|
||||||
else if (error.response && error.response.status >= 400) {
|
else if (error.response && error.response.status >= 400) {
|
||||||
error.code = 'ERR_CLIENT';
|
error.code = 'ERR_CLIENT';
|
||||||
error.detailedMessage =
|
error.detailedMessage = 'A client-side error occurred. Please check your request.';
|
||||||
'A client-side error occurred. Please check your request.';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// when unknown network issue occurs
|
// when unknown network issue occurs
|
||||||
@@ -60,13 +56,12 @@ function enhanceNetworkError(error) {
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function createEnhancedClient(config = {}) {
|
export function createEnhancedClient(config = {}) {
|
||||||
const client = axios.create(config);
|
const client = axios.create(config);
|
||||||
|
|
||||||
client.interceptors.response.use(
|
client.interceptors.response.use(
|
||||||
response => response,
|
(response) => response,
|
||||||
error => {
|
(error) => {
|
||||||
throw enhanceNetworkError(error);
|
throw enhanceNetworkError(error);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<title>axios - post example</title>
|
<title>axios - post example</title>
|
||||||
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" />
|
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="container">
|
<body class="container">
|
||||||
<h1>axios.post</h1>
|
<h1>axios.post</h1>
|
||||||
|
|
||||||
@@ -37,4 +39,5 @@
|
|||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -8,9 +8,9 @@ export default function (req, res) {
|
|||||||
req.on('end', function () {
|
req.on('end', function () {
|
||||||
console.log('POST data received');
|
console.log('POST data received');
|
||||||
res.writeHead(200, {
|
res.writeHead(200, {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json',
|
||||||
});
|
});
|
||||||
res.write(JSON.stringify(data));
|
res.write(JSON.stringify(data));
|
||||||
res.end();
|
res.end();
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<title>Axios - Multipart Form Example</title>
|
<title>Axios - Multipart Form Example</title>
|
||||||
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" />
|
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" />
|
||||||
@@ -344,7 +345,8 @@
|
|||||||
margin: 10px;
|
margin: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-section, .result-section {
|
.form-section,
|
||||||
|
.result-section {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,6 +362,7 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
@@ -409,7 +412,8 @@
|
|||||||
|
|
||||||
<div class="postSubmission">
|
<div class="postSubmission">
|
||||||
<div id="checkNetwork" class="checkNetwork hidden">
|
<div id="checkNetwork" class="checkNetwork hidden">
|
||||||
<span class="text-strong">Check devtools to see details of request sent, and content of FormData. </span><br/>
|
<span class="text-strong">Check devtools to see details of request sent, and content of FormData.
|
||||||
|
</span><br />
|
||||||
In Chromium check: devtools -> network tab -> request to "server" -> payload tab
|
In Chromium check: devtools -> network tab -> request to "server" -> payload tab
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -501,26 +505,27 @@
|
|||||||
headers: passAsFormData ? { "Content-Type": "multipart/form-data" } : {},
|
headers: passAsFormData ? { "Content-Type": "multipart/form-data" } : {},
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
errorOutput.innerHTML = "Successfully posted!";
|
errorOutput.textContent = "Successfully posted!";
|
||||||
errorOutput.classList.remove("text-danger");
|
errorOutput.classList.remove("text-danger");
|
||||||
errorOutput.classList.add("text-success");
|
errorOutput.classList.add("text-success");
|
||||||
errorOutput.classList.remove("hidden");
|
errorOutput.classList.remove("hidden");
|
||||||
|
|
||||||
// Display the response in the result section
|
// Display the response in the result section
|
||||||
resultContent.innerHTML = JSON.stringify(res.data, null, 2);
|
resultContent.textContent = JSON.stringify(res.data, null, 2);
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.error("Error posting data:", err);
|
console.error("Error posting data:", err);
|
||||||
errorOutput.innerHTML = `${err.message}`;
|
errorOutput.textContent = `${err.message}`;
|
||||||
errorOutput.classList.add("text-danger");
|
errorOutput.classList.add("text-danger");
|
||||||
errorOutput.classList.remove("text-success");
|
errorOutput.classList.remove("text-success");
|
||||||
errorOutput.classList.remove("hidden");
|
errorOutput.classList.remove("hidden");
|
||||||
|
|
||||||
// Display error in the result section
|
// Display error in the result section
|
||||||
resultContent.innerHTML = `Error: ${err.message}\n\n${JSON.stringify(err.response?.data || {}, null, 2)}`;
|
resultContent.textContent = `Error: ${err.message}\n\n${JSON.stringify(err.response?.data || {}, null, 2)}`;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -1,13 +1,11 @@
|
|||||||
export default function (req, res) {
|
export default function (req, res) {
|
||||||
|
req.on('data', function (chunk) {});
|
||||||
req.on('data', function (chunk) {
|
|
||||||
});
|
|
||||||
|
|
||||||
req.on('end', function () {
|
req.on('end', function () {
|
||||||
console.log('POST received');
|
console.log('POST received');
|
||||||
res.writeHead(200, {
|
res.writeHead(200, {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json',
|
||||||
});
|
});
|
||||||
res.end();
|
res.end();
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|||||||
+17
-14
@@ -2,7 +2,7 @@ import fs from 'fs';
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
import http from 'http';
|
import http from 'http';
|
||||||
import minimist from 'minimist';
|
import minimist from 'minimist';
|
||||||
import url from "url";
|
import url from 'url';
|
||||||
|
|
||||||
const argv = minimist(process.argv.slice(2));
|
const argv = minimist(process.argv.slice(2));
|
||||||
let server;
|
let server;
|
||||||
@@ -31,7 +31,9 @@ function listDirs(root) {
|
|||||||
function getIndexTemplate() {
|
function getIndexTemplate() {
|
||||||
const links = dirs.map(function (dir) {
|
const links = dirs.map(function (dir) {
|
||||||
const url = '/' + dir;
|
const url = '/' + dir;
|
||||||
return '<li onclick="document.location=\'' + url + '\'"><a href="' + url + '">' + url + '</a></li>';
|
return (
|
||||||
|
'<li onclick="document.location=\'' + url + '\'"><a href="' + url + '">' + url + '</a></li>'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -89,7 +91,7 @@ function pipeFileToResponse(res, file, type) {
|
|||||||
|
|
||||||
if (type) {
|
if (type) {
|
||||||
res.writeHead(200, {
|
res.writeHead(200, {
|
||||||
"Content-Type": type
|
'Content-Type': type,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
res.writeHead(200);
|
res.writeHead(200);
|
||||||
@@ -97,21 +99,21 @@ function pipeFileToResponse(res, file, type) {
|
|||||||
|
|
||||||
const stream = fs.createReadStream(resolvedPath);
|
const stream = fs.createReadStream(resolvedPath);
|
||||||
|
|
||||||
stream.on("error", (err) => {
|
stream.on('error', (err) => {
|
||||||
console.error("Error while reading file:", err.message);
|
console.error('Error while reading file:', err.message);
|
||||||
if (!res.headersSent) {
|
if (!res.headersSent) {
|
||||||
res.writeHead(500, { "Content-Type": "text/plain" });
|
res.writeHead(500, { 'Content-Type': 'text/plain' });
|
||||||
}
|
}
|
||||||
res.end("File read error");
|
res.end('File read error');
|
||||||
});
|
});
|
||||||
|
|
||||||
stream.pipe(res);
|
stream.pipe(res);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Unexpected error:", err.message);
|
console.error('Unexpected error:', err.message);
|
||||||
if (!res.headersSent) {
|
if (!res.headersSent) {
|
||||||
res.writeHead(500, { "Content-Type": "text/plain" });
|
res.writeHead(500, { 'Content-Type': 'text/plain' });
|
||||||
}
|
}
|
||||||
res.end("Internal server error");
|
res.end('Internal server error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,9 +170,11 @@ server = http.createServer(function (req, res) {
|
|||||||
// Process server request
|
// Process server request
|
||||||
else if (new RegExp('(' + dirs.join('|') + ')\/server').test(url)) {
|
else if (new RegExp('(' + dirs.join('|') + ')\/server').test(url)) {
|
||||||
if (fs.existsSync(path.join(__dirname, url + '.js'))) {
|
if (fs.existsSync(path.join(__dirname, url + '.js'))) {
|
||||||
import('file://' + path.join(__dirname, url + '.js')).then((server) => {
|
import('file://' + path.join(__dirname, url + '.js'))
|
||||||
|
.then((server) => {
|
||||||
server.default(req, res);
|
server.default(req, res);
|
||||||
}).catch(err => {
|
})
|
||||||
|
.catch((err) => {
|
||||||
console.error('Error importing server:', err);
|
console.error('Error importing server:', err);
|
||||||
send404(res);
|
send404(res);
|
||||||
});
|
});
|
||||||
@@ -178,8 +182,7 @@ server = http.createServer(function (req, res) {
|
|||||||
send404(res);
|
send404(res);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
send404(res);
|
send404(res);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<title>axios - transform response example</title>
|
<title>axios - transform response example</title>
|
||||||
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" />
|
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="container">
|
<body class="container">
|
||||||
<h1>transformResponse</h1>
|
<h1>transformResponse</h1>
|
||||||
|
|
||||||
@@ -41,4 +43,5 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<title>axios - file upload example</title>
|
<title>axios - file upload example</title>
|
||||||
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" />
|
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="container">
|
<body class="container">
|
||||||
<h1>file upload</h1>
|
<h1>file upload</h1>
|
||||||
|
|
||||||
@@ -29,20 +31,23 @@
|
|||||||
var config = {
|
var config = {
|
||||||
onUploadProgress: function (progressEvent) {
|
onUploadProgress: function (progressEvent) {
|
||||||
var percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total);
|
var percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total);
|
||||||
|
output.className = 'container';
|
||||||
|
output.textContent = 'Upload progress: ' + percentCompleted + '%';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
axios.put('/upload/server', data, config)
|
axios.put('/upload/server', data, config)
|
||||||
.then(function (res) {
|
.then(function (res) {
|
||||||
output.className = 'container';
|
output.className = 'container';
|
||||||
output.innerHTML = res.data;
|
output.textContent = res.data;
|
||||||
})
|
})
|
||||||
.catch(function (err) {
|
.catch(function (err) {
|
||||||
output.className = 'container text-danger';
|
output.className = 'container text-danger';
|
||||||
output.innerHTML = err.message;
|
output.textContent = err.message;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
export default function (req, res) {
|
export default function (req, res) {
|
||||||
let data = '';
|
let _data = '';
|
||||||
|
|
||||||
req.on('data', function (chunk) {
|
req.on('data', function (chunk) {
|
||||||
data += chunk;
|
_data += chunk;
|
||||||
});
|
});
|
||||||
|
|
||||||
req.on('end', function () {
|
req.on('end', function () {
|
||||||
@@ -10,4 +10,4 @@ export default function (req, res) {
|
|||||||
res.writeHead(200);
|
res.writeHead(200);
|
||||||
res.end();
|
res.end();
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|||||||
+31
-31
@@ -1,7 +1,7 @@
|
|||||||
import gulp from 'gulp';
|
import gulp from 'gulp';
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import axios from './bin/githubAxios.js';
|
import axios from './bin/githubAxios.js';
|
||||||
import minimist from 'minimist'
|
import minimist from 'minimist';
|
||||||
|
|
||||||
const argv = minimist(process.argv.slice(2));
|
const argv = minimist(process.argv.slice(2));
|
||||||
|
|
||||||
@@ -10,21 +10,14 @@ const argv = minimist(process.argv.slice(2));
|
|||||||
});
|
});
|
||||||
|
|
||||||
const clear = gulp.task('clear', async function () {
|
const clear = gulp.task('clear', async function () {
|
||||||
await fs.emptyDir('./dist/')
|
await fs.emptyDir('./dist/');
|
||||||
});
|
});
|
||||||
|
|
||||||
const bower = gulp.task('bower', async function () {
|
const bower = gulp.task('bower', async function () {
|
||||||
const npm = JSON.parse(await fs.readFile('package.json'));
|
const npm = JSON.parse(await fs.readFile('package.json'));
|
||||||
const bower = JSON.parse(await fs.readFile('bower.json'));
|
const bower = JSON.parse(await fs.readFile('bower.json'));
|
||||||
|
|
||||||
const fields = [
|
const fields = ['name', 'description', 'version', 'homepage', 'license', 'keywords'];
|
||||||
'name',
|
|
||||||
'description',
|
|
||||||
'version',
|
|
||||||
'homepage',
|
|
||||||
'license',
|
|
||||||
'keywords'
|
|
||||||
];
|
|
||||||
|
|
||||||
for (let i = 0, l = fields.length; i < l; i++) {
|
for (let i = 0, l = fields.length; i < l; i++) {
|
||||||
const field = fields[i];
|
const field = fields[i];
|
||||||
@@ -35,16 +28,23 @@ const bower = gulp.task('bower', async function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
async function getContributors(user, repo, maxCount = 1) {
|
async function getContributors(user, repo, maxCount = 1) {
|
||||||
const contributors = (await axios.get(
|
const contributors = (
|
||||||
|
await axios.get(
|
||||||
`https://api.github.com/repos/${encodeURIComponent(user)}/${encodeURIComponent(repo)}/contributors`,
|
`https://api.github.com/repos/${encodeURIComponent(user)}/${encodeURIComponent(repo)}/contributors`,
|
||||||
{ params: { per_page: maxCount } }
|
{ params: { per_page: maxCount } }
|
||||||
)).data;
|
)
|
||||||
|
).data;
|
||||||
|
|
||||||
return Promise.all(contributors.map(async (contributor) => {
|
return Promise.all(
|
||||||
return {...contributor, ...(await axios.get(
|
contributors.map(async (contributor) => {
|
||||||
`https://api.github.com/users/${encodeURIComponent(contributor.login)}`
|
return {
|
||||||
)).data};
|
...contributor,
|
||||||
}))
|
...(
|
||||||
|
await axios.get(`https://api.github.com/users/${encodeURIComponent(contributor.login)}`)
|
||||||
|
).data,
|
||||||
|
};
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const packageJSON = gulp.task('package', async function () {
|
const packageJSON = gulp.task('package', async function () {
|
||||||
@@ -57,9 +57,10 @@ const packageJSON = gulp.task('package', async function () {
|
|||||||
|
|
||||||
npm.contributors = contributors
|
npm.contributors = contributors
|
||||||
.filter(
|
.filter(
|
||||||
({type, contributions}) => type.toLowerCase() === 'user' && contributions >= CONTRIBUTION_THRESHOLD
|
({ type, contributions }) =>
|
||||||
|
type.toLowerCase() === 'user' && contributions >= CONTRIBUTION_THRESHOLD
|
||||||
)
|
)
|
||||||
.map(({login, name, url}) => `${name || login} (https://github.com/${login})`);
|
.map(({ login, name, _ }) => `${name || login} (https://github.com/${login})`);
|
||||||
|
|
||||||
await fs.writeFile('package.json', JSON.stringify(npm, null, 2));
|
await fs.writeFile('package.json', JSON.stringify(npm, null, 2));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -75,19 +76,18 @@ const env = gulp.task('env', async function () {
|
|||||||
|
|
||||||
const envFilePath = './lib/env/data.js';
|
const envFilePath = './lib/env/data.js';
|
||||||
|
|
||||||
await fs.writeFile(envFilePath, Object.entries({
|
await fs.writeFile(
|
||||||
VERSION: (argv.bump || npm.version).replace(/^v/, '')
|
envFilePath,
|
||||||
}).map(([key, value]) => {
|
Object.entries({
|
||||||
return `export const ${key} = ${JSON.stringify(value)};`
|
VERSION: (argv.bump || npm.version).replace(/^v/, ''),
|
||||||
}).join('\n'));
|
})
|
||||||
|
.map(([key, value]) => {
|
||||||
|
return `export const ${key} = ${JSON.stringify(value)};`;
|
||||||
|
})
|
||||||
|
.join('\n')
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
const version = gulp.series('bower', 'env', 'package');
|
const version = gulp.series('bower', 'env', 'package');
|
||||||
|
|
||||||
export {
|
export { bower, env, clear, version, packageJSON };
|
||||||
bower,
|
|
||||||
env,
|
|
||||||
clear,
|
|
||||||
version,
|
|
||||||
packageJSON
|
|
||||||
}
|
|
||||||
|
|||||||
+213
-88
@@ -2,30 +2,54 @@ interface RawAxiosHeaders {
|
|||||||
[key: string]: axios.AxiosHeaderValue;
|
[key: string]: axios.AxiosHeaderValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
type MethodsHeaders = Partial<{
|
type MethodsHeaders = Partial<
|
||||||
|
{
|
||||||
[Key in axios.Method as Lowercase<Key>]: AxiosHeaders;
|
[Key in axios.Method as Lowercase<Key>]: AxiosHeaders;
|
||||||
} & {common: AxiosHeaders}>;
|
} & { common: AxiosHeaders }
|
||||||
|
>;
|
||||||
|
|
||||||
type AxiosHeaderMatcher = string | RegExp | ((this: AxiosHeaders, value: string, name: string) => boolean);
|
type AxiosHeaderMatcher =
|
||||||
|
| string
|
||||||
|
| RegExp
|
||||||
|
| ((this: AxiosHeaders, value: string, name: string) => boolean);
|
||||||
|
|
||||||
type AxiosHeaderParser = (this: AxiosHeaders, value: axios.AxiosHeaderValue, header: string) => any;
|
type AxiosHeaderParser = (this: AxiosHeaders, value: axios.AxiosHeaderValue, header: string) => any;
|
||||||
|
|
||||||
type CommonRequestHeadersList = 'Accept' | 'Content-Length' | 'User-Agent'| 'Content-Encoding' | 'Authorization';
|
type CommonRequestHeadersList =
|
||||||
|
| 'Accept'
|
||||||
|
| 'Content-Length'
|
||||||
|
| 'User-Agent'
|
||||||
|
| 'Content-Encoding'
|
||||||
|
| 'Authorization';
|
||||||
|
|
||||||
type ContentType = axios.AxiosHeaderValue | 'text/html' | 'text/plain' | 'multipart/form-data' | 'application/json' | 'application/x-www-form-urlencoded' | 'application/octet-stream';
|
type ContentType =
|
||||||
|
| axios.AxiosHeaderValue
|
||||||
|
| 'text/html'
|
||||||
|
| 'text/plain'
|
||||||
|
| 'multipart/form-data'
|
||||||
|
| 'application/json'
|
||||||
|
| 'application/x-www-form-urlencoded'
|
||||||
|
| 'application/octet-stream';
|
||||||
|
|
||||||
type CommonResponseHeadersList = 'Server' | 'Content-Type' | 'Content-Length' | 'Cache-Control'| 'Content-Encoding';
|
type CommonResponseHeadersList =
|
||||||
|
| 'Server'
|
||||||
|
| 'Content-Type'
|
||||||
|
| 'Content-Length'
|
||||||
|
| 'Cache-Control'
|
||||||
|
| 'Content-Encoding';
|
||||||
|
|
||||||
type BrowserProgressEvent = any;
|
type BrowserProgressEvent = any;
|
||||||
|
|
||||||
declare class AxiosHeaders {
|
declare class AxiosHeaders {
|
||||||
constructor(
|
constructor(headers?: RawAxiosHeaders | AxiosHeaders | string);
|
||||||
headers?: RawAxiosHeaders | AxiosHeaders | string
|
|
||||||
);
|
|
||||||
|
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
|
|
||||||
set(headerName?: string, value?: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
set(
|
||||||
|
headerName?: string,
|
||||||
|
value?: axios.AxiosHeaderValue,
|
||||||
|
rewrite?: boolean | AxiosHeaderMatcher
|
||||||
|
): AxiosHeaders;
|
||||||
set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean): AxiosHeaders;
|
set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean): AxiosHeaders;
|
||||||
|
|
||||||
get(headerName: string, parser: RegExp): RegExpExecArray | null;
|
get(headerName: string, parser: RegExp): RegExpExecArray | null;
|
||||||
@@ -39,7 +63,9 @@ declare class AxiosHeaders {
|
|||||||
|
|
||||||
normalize(format: boolean): AxiosHeaders;
|
normalize(format: boolean): AxiosHeaders;
|
||||||
|
|
||||||
concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): AxiosHeaders;
|
concat(
|
||||||
|
...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>
|
||||||
|
): AxiosHeaders;
|
||||||
|
|
||||||
toJSON(asStrings?: boolean): RawAxiosHeaders;
|
toJSON(asStrings?: boolean): RawAxiosHeaders;
|
||||||
|
|
||||||
@@ -47,14 +73,19 @@ declare class AxiosHeaders {
|
|||||||
|
|
||||||
static accessor(header: string | string[]): AxiosHeaders;
|
static accessor(header: string | string[]): AxiosHeaders;
|
||||||
|
|
||||||
static concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): AxiosHeaders;
|
static concat(
|
||||||
|
...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>
|
||||||
|
): AxiosHeaders;
|
||||||
|
|
||||||
setContentType(value: ContentType, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
setContentType(value: ContentType, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
||||||
getContentType(parser?: RegExp): RegExpExecArray | null;
|
getContentType(parser?: RegExp): RegExpExecArray | null;
|
||||||
getContentType(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
|
getContentType(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
|
||||||
hasContentType(matcher?: AxiosHeaderMatcher): boolean;
|
hasContentType(matcher?: AxiosHeaderMatcher): boolean;
|
||||||
|
|
||||||
setContentLength(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
setContentLength(
|
||||||
|
value: axios.AxiosHeaderValue,
|
||||||
|
rewrite?: boolean | AxiosHeaderMatcher
|
||||||
|
): AxiosHeaders;
|
||||||
getContentLength(parser?: RegExp): RegExpExecArray | null;
|
getContentLength(parser?: RegExp): RegExpExecArray | null;
|
||||||
getContentLength(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
|
getContentLength(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
|
||||||
hasContentLength(matcher?: AxiosHeaderMatcher): boolean;
|
hasContentLength(matcher?: AxiosHeaderMatcher): boolean;
|
||||||
@@ -69,12 +100,18 @@ declare class AxiosHeaders {
|
|||||||
getUserAgent(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
|
getUserAgent(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
|
||||||
hasUserAgent(matcher?: AxiosHeaderMatcher): boolean;
|
hasUserAgent(matcher?: AxiosHeaderMatcher): boolean;
|
||||||
|
|
||||||
setContentEncoding(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
setContentEncoding(
|
||||||
|
value: axios.AxiosHeaderValue,
|
||||||
|
rewrite?: boolean | AxiosHeaderMatcher
|
||||||
|
): AxiosHeaders;
|
||||||
getContentEncoding(parser?: RegExp): RegExpExecArray | null;
|
getContentEncoding(parser?: RegExp): RegExpExecArray | null;
|
||||||
getContentEncoding(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
|
getContentEncoding(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
|
||||||
hasContentEncoding(matcher?: AxiosHeaderMatcher): boolean;
|
hasContentEncoding(matcher?: AxiosHeaderMatcher): boolean;
|
||||||
|
|
||||||
setAuthorization(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
setAuthorization(
|
||||||
|
value: axios.AxiosHeaderValue,
|
||||||
|
rewrite?: boolean | AxiosHeaderMatcher
|
||||||
|
): AxiosHeaders;
|
||||||
getAuthorization(parser?: RegExp): RegExpExecArray | null;
|
getAuthorization(parser?: RegExp): RegExpExecArray | null;
|
||||||
getAuthorization(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
|
getAuthorization(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
|
||||||
hasAuthorization(matcher?: AxiosHeaderMatcher): boolean;
|
hasAuthorization(matcher?: AxiosHeaderMatcher): boolean;
|
||||||
@@ -108,24 +145,23 @@ declare class AxiosError<T = unknown, D = any> extends Error {
|
|||||||
config?: axios.InternalAxiosRequestConfig<D>,
|
config?: axios.InternalAxiosRequestConfig<D>,
|
||||||
request?: any,
|
request?: any,
|
||||||
response?: axios.AxiosResponse<T, D>,
|
response?: axios.AxiosResponse<T, D>,
|
||||||
customProps?: object,
|
customProps?: object
|
||||||
): AxiosError<T, D>;
|
): AxiosError<T, D>;
|
||||||
static readonly ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS";
|
static readonly ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
|
||||||
static readonly ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE";
|
static readonly ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
|
||||||
static readonly ERR_BAD_OPTION = "ERR_BAD_OPTION";
|
static readonly ERR_BAD_OPTION = 'ERR_BAD_OPTION';
|
||||||
static readonly ERR_NETWORK = "ERR_NETWORK";
|
static readonly ERR_NETWORK = 'ERR_NETWORK';
|
||||||
static readonly ERR_DEPRECATED = "ERR_DEPRECATED";
|
static readonly ERR_DEPRECATED = 'ERR_DEPRECATED';
|
||||||
static readonly ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE";
|
static readonly ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
|
||||||
static readonly ERR_BAD_REQUEST = "ERR_BAD_REQUEST";
|
static readonly ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
|
||||||
static readonly ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";
|
static readonly ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
|
||||||
static readonly ERR_INVALID_URL = "ERR_INVALID_URL";
|
static readonly ERR_INVALID_URL = 'ERR_INVALID_URL';
|
||||||
static readonly ERR_CANCELED = "ERR_CANCELED";
|
static readonly ERR_CANCELED = 'ERR_CANCELED';
|
||||||
static readonly ECONNABORTED = "ECONNABORTED";
|
static readonly ECONNABORTED = 'ECONNABORTED';
|
||||||
static readonly ETIMEDOUT = "ETIMEDOUT";
|
static readonly ETIMEDOUT = 'ETIMEDOUT';
|
||||||
}
|
}
|
||||||
|
|
||||||
declare class CanceledError<T> extends AxiosError<T> {
|
declare class CanceledError<T> extends AxiosError<T> {}
|
||||||
}
|
|
||||||
|
|
||||||
declare class Axios {
|
declare class Axios {
|
||||||
constructor(config?: axios.AxiosRequestConfig);
|
constructor(config?: axios.AxiosRequestConfig);
|
||||||
@@ -135,17 +171,55 @@ declare class Axios {
|
|||||||
response: axios.AxiosInterceptorManager<axios.AxiosResponse>;
|
response: axios.AxiosInterceptorManager<axios.AxiosResponse>;
|
||||||
};
|
};
|
||||||
getUri(config?: axios.AxiosRequestConfig): string;
|
getUri(config?: axios.AxiosRequestConfig): string;
|
||||||
request<T = any, R = axios.AxiosResponse<T>, D = any>(config: axios.AxiosRequestConfig<D>): Promise<R>;
|
request<T = any, R = axios.AxiosResponse<T>, D = any>(
|
||||||
get<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R>;
|
config: axios.AxiosRequestConfig<D>
|
||||||
delete<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R>;
|
): Promise<R>;
|
||||||
head<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R>;
|
get<T = any, R = axios.AxiosResponse<T>, D = any>(
|
||||||
options<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R>;
|
url: string,
|
||||||
post<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
|
config?: axios.AxiosRequestConfig<D>
|
||||||
put<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
|
): Promise<R>;
|
||||||
patch<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
|
delete<T = any, R = axios.AxiosResponse<T>, D = any>(
|
||||||
postForm<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
|
url: string,
|
||||||
putForm<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
|
config?: axios.AxiosRequestConfig<D>
|
||||||
patchForm<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
|
): Promise<R>;
|
||||||
|
head<T = any, R = axios.AxiosResponse<T>, D = any>(
|
||||||
|
url: string,
|
||||||
|
config?: axios.AxiosRequestConfig<D>
|
||||||
|
): Promise<R>;
|
||||||
|
options<T = any, R = axios.AxiosResponse<T>, D = any>(
|
||||||
|
url: string,
|
||||||
|
config?: axios.AxiosRequestConfig<D>
|
||||||
|
): Promise<R>;
|
||||||
|
post<T = any, R = axios.AxiosResponse<T>, D = any>(
|
||||||
|
url: string,
|
||||||
|
data?: D,
|
||||||
|
config?: axios.AxiosRequestConfig<D>
|
||||||
|
): Promise<R>;
|
||||||
|
put<T = any, R = axios.AxiosResponse<T>, D = any>(
|
||||||
|
url: string,
|
||||||
|
data?: D,
|
||||||
|
config?: axios.AxiosRequestConfig<D>
|
||||||
|
): Promise<R>;
|
||||||
|
patch<T = any, R = axios.AxiosResponse<T>, D = any>(
|
||||||
|
url: string,
|
||||||
|
data?: D,
|
||||||
|
config?: axios.AxiosRequestConfig<D>
|
||||||
|
): Promise<R>;
|
||||||
|
postForm<T = any, R = axios.AxiosResponse<T>, D = any>(
|
||||||
|
url: string,
|
||||||
|
data?: D,
|
||||||
|
config?: axios.AxiosRequestConfig<D>
|
||||||
|
): Promise<R>;
|
||||||
|
putForm<T = any, R = axios.AxiosResponse<T>, D = any>(
|
||||||
|
url: string,
|
||||||
|
data?: D,
|
||||||
|
config?: axios.AxiosRequestConfig<D>
|
||||||
|
): Promise<R>;
|
||||||
|
patchForm<T = any, R = axios.AxiosResponse<T>, D = any>(
|
||||||
|
url: string,
|
||||||
|
data?: D,
|
||||||
|
config?: axios.AxiosRequestConfig<D>
|
||||||
|
): Promise<R>;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare enum HttpStatusCode {
|
declare enum HttpStatusCode {
|
||||||
@@ -219,11 +293,13 @@ type InternalAxiosError<T = unknown, D = any> = AxiosError<T, D>;
|
|||||||
declare namespace axios {
|
declare namespace axios {
|
||||||
type AxiosError<T = unknown, D = any> = InternalAxiosError<T, D>;
|
type AxiosError<T = unknown, D = any> = InternalAxiosError<T, D>;
|
||||||
|
|
||||||
type RawAxiosRequestHeaders = Partial<RawAxiosHeaders & {
|
type RawAxiosRequestHeaders = Partial<
|
||||||
|
RawAxiosHeaders & {
|
||||||
[Key in CommonRequestHeadersList]: AxiosHeaderValue;
|
[Key in CommonRequestHeadersList]: AxiosHeaderValue;
|
||||||
} & {
|
} & {
|
||||||
'Content-Type': ContentType
|
'Content-Type': ContentType;
|
||||||
}>;
|
}
|
||||||
|
>;
|
||||||
|
|
||||||
type AxiosRequestHeaders = RawAxiosRequestHeaders & AxiosHeaders;
|
type AxiosRequestHeaders = RawAxiosRequestHeaders & AxiosHeaders;
|
||||||
|
|
||||||
@@ -232,7 +308,7 @@ declare namespace axios {
|
|||||||
type RawCommonResponseHeaders = {
|
type RawCommonResponseHeaders = {
|
||||||
[Key in CommonResponseHeadersList]: AxiosHeaderValue;
|
[Key in CommonResponseHeadersList]: AxiosHeaderValue;
|
||||||
} & {
|
} & {
|
||||||
"set-cookie": string[];
|
'set-cookie': string[];
|
||||||
};
|
};
|
||||||
|
|
||||||
type RawAxiosResponseHeaders = Partial<RawAxiosHeaders & RawCommonResponseHeaders>;
|
type RawAxiosResponseHeaders = Partial<RawAxiosHeaders & RawCommonResponseHeaders>;
|
||||||
@@ -244,7 +320,12 @@ declare namespace axios {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface AxiosResponseTransformer {
|
interface AxiosResponseTransformer {
|
||||||
(this: InternalAxiosRequestConfig, data: any, headers: AxiosResponseHeaders, status?: number): any;
|
(
|
||||||
|
this: InternalAxiosRequestConfig,
|
||||||
|
data: any,
|
||||||
|
headers: AxiosResponseHeaders,
|
||||||
|
status?: number
|
||||||
|
): any;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AxiosAdapter {
|
interface AxiosAdapter {
|
||||||
@@ -264,39 +345,54 @@ declare namespace axios {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Method =
|
type Method =
|
||||||
| 'get' | 'GET'
|
| 'get'
|
||||||
| 'delete' | 'DELETE'
|
| 'GET'
|
||||||
| 'head' | 'HEAD'
|
| 'delete'
|
||||||
| 'options' | 'OPTIONS'
|
| 'DELETE'
|
||||||
| 'post' | 'POST'
|
| 'head'
|
||||||
| 'put' | 'PUT'
|
| 'HEAD'
|
||||||
| 'patch' | 'PATCH'
|
| 'options'
|
||||||
| 'purge' | 'PURGE'
|
| 'OPTIONS'
|
||||||
| 'link' | 'LINK'
|
| 'post'
|
||||||
| 'unlink' | 'UNLINK';
|
| 'POST'
|
||||||
|
| 'put'
|
||||||
|
| 'PUT'
|
||||||
|
| 'patch'
|
||||||
|
| 'PATCH'
|
||||||
|
| 'purge'
|
||||||
|
| 'PURGE'
|
||||||
|
| 'link'
|
||||||
|
| 'LINK'
|
||||||
|
| 'unlink'
|
||||||
|
| 'UNLINK';
|
||||||
|
|
||||||
type ResponseType =
|
type ResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream' | 'formdata';
|
||||||
| 'arraybuffer'
|
|
||||||
| 'blob'
|
|
||||||
| 'document'
|
|
||||||
| 'json'
|
|
||||||
| 'text'
|
|
||||||
| 'stream'
|
|
||||||
| 'formdata';
|
|
||||||
|
|
||||||
type responseEncoding =
|
type responseEncoding =
|
||||||
| 'ascii' | 'ASCII'
|
| 'ascii'
|
||||||
| 'ansi' | 'ANSI'
|
| 'ASCII'
|
||||||
| 'binary' | 'BINARY'
|
| 'ansi'
|
||||||
| 'base64' | 'BASE64'
|
| 'ANSI'
|
||||||
| 'base64url' | 'BASE64URL'
|
| 'binary'
|
||||||
| 'hex' | 'HEX'
|
| 'BINARY'
|
||||||
| 'latin1' | 'LATIN1'
|
| 'base64'
|
||||||
| 'ucs-2' | 'UCS-2'
|
| 'BASE64'
|
||||||
| 'ucs2' | 'UCS2'
|
| 'base64url'
|
||||||
| 'utf-8' | 'UTF-8'
|
| 'BASE64URL'
|
||||||
| 'utf8' | 'UTF8'
|
| 'hex'
|
||||||
| 'utf16le' | 'UTF16LE';
|
| 'HEX'
|
||||||
|
| 'latin1'
|
||||||
|
| 'LATIN1'
|
||||||
|
| 'ucs-2'
|
||||||
|
| 'UCS-2'
|
||||||
|
| 'ucs2'
|
||||||
|
| 'UCS2'
|
||||||
|
| 'utf-8'
|
||||||
|
| 'UTF-8'
|
||||||
|
| 'utf8'
|
||||||
|
| 'UTF8'
|
||||||
|
| 'utf16le'
|
||||||
|
| 'UTF16LE';
|
||||||
|
|
||||||
interface TransitionalOptions {
|
interface TransitionalOptions {
|
||||||
silentJSONParsing?: boolean;
|
silentJSONParsing?: boolean;
|
||||||
@@ -336,8 +432,7 @@ declare namespace axios {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// tslint:disable-next-line
|
// tslint:disable-next-line
|
||||||
interface FormSerializerOptions extends SerializerOptions {
|
interface FormSerializerOptions extends SerializerOptions {}
|
||||||
}
|
|
||||||
|
|
||||||
interface ParamEncoder {
|
interface ParamEncoder {
|
||||||
(value: any, defaultEncoder: (value: any) => any): any;
|
(value: any, defaultEncoder: (value: any) => any): any;
|
||||||
@@ -411,7 +506,10 @@ declare namespace axios {
|
|||||||
maxBodyLength?: number;
|
maxBodyLength?: number;
|
||||||
maxRedirects?: number;
|
maxRedirects?: number;
|
||||||
maxRate?: number | [MaxUploadRate, MaxDownloadRate];
|
maxRate?: number | [MaxUploadRate, MaxDownloadRate];
|
||||||
beforeRedirect?: (options: Record<string, any>, responseDetails: {headers: Record<string, string>, statusCode: HttpStatusCode}) => void;
|
beforeRedirect?: (
|
||||||
|
options: Record<string, any>,
|
||||||
|
responseDetails: { headers: Record<string, string>; statusCode: HttpStatusCode }
|
||||||
|
) => void;
|
||||||
socketPath?: string | null;
|
socketPath?: string | null;
|
||||||
transport?: any;
|
transport?: any;
|
||||||
httpAgent?: any;
|
httpAgent?: any;
|
||||||
@@ -433,10 +531,27 @@ declare namespace axios {
|
|||||||
};
|
};
|
||||||
formSerializer?: FormSerializerOptions;
|
formSerializer?: FormSerializerOptions;
|
||||||
family?: AddressFamily;
|
family?: AddressFamily;
|
||||||
lookup?: ((hostname: string, options: object, cb: (err: Error | null, address: LookupAddress | LookupAddress[], family?: AddressFamily) => void) => void) |
|
lookup?:
|
||||||
((hostname: string, options: object) => Promise<[address: LookupAddressEntry | LookupAddressEntry[], family?: AddressFamily] | LookupAddress>);
|
| ((
|
||||||
|
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);
|
withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined);
|
||||||
fetchOptions?: Omit<RequestInit, 'body' | 'headers' | 'method' | 'signal'> | Record<string, any>;
|
fetchOptions?:
|
||||||
|
| Omit<RequestInit, 'body' | 'headers' | 'method' | 'signal'>
|
||||||
|
| Record<string, any>;
|
||||||
httpVersion?: 1 | 2;
|
httpVersion?: 1 | 2;
|
||||||
http2Options?: Record<string, any> & {
|
http2Options?: Record<string, any> & {
|
||||||
sessionTimeout?: number;
|
sessionTimeout?: number;
|
||||||
@@ -476,7 +591,7 @@ declare namespace axios {
|
|||||||
data: T;
|
data: T;
|
||||||
status: number;
|
status: number;
|
||||||
statusText: string;
|
statusText: string;
|
||||||
headers: H & RawAxiosResponseHeaders | AxiosResponseHeaders;
|
headers: (H & RawAxiosResponseHeaders) | AxiosResponseHeaders;
|
||||||
config: InternalAxiosRequestConfig<D>;
|
config: InternalAxiosRequestConfig<D>;
|
||||||
request?: any;
|
request?: any;
|
||||||
}
|
}
|
||||||
@@ -546,13 +661,16 @@ declare namespace axios {
|
|||||||
|
|
||||||
interface AxiosInstance extends Axios {
|
interface AxiosInstance extends Axios {
|
||||||
<T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig<D>): Promise<R>;
|
<T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig<D>): Promise<R>;
|
||||||
<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
|
<T = any, R = AxiosResponse<T>, D = any>(
|
||||||
|
url: string,
|
||||||
|
config?: AxiosRequestConfig<D>
|
||||||
|
): Promise<R>;
|
||||||
|
|
||||||
create(config?: CreateAxiosDefaults): AxiosInstance;
|
create(config?: CreateAxiosDefaults): AxiosInstance;
|
||||||
defaults: Omit<AxiosDefaults, 'headers'> & {
|
defaults: Omit<AxiosDefaults, 'headers'> & {
|
||||||
headers: HeadersDefaults & {
|
headers: HeadersDefaults & {
|
||||||
[key: string]: AxiosHeaderValue
|
[key: string]: AxiosHeaderValue;
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -578,11 +696,18 @@ declare namespace axios {
|
|||||||
all<T>(values: Array<T | Promise<T>>): Promise<T[]>;
|
all<T>(values: Array<T | Promise<T>>): Promise<T[]>;
|
||||||
spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R;
|
spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R;
|
||||||
isAxiosError<T = any, D = any>(payload: any): payload is AxiosError<T, D>;
|
isAxiosError<T = any, D = any>(payload: any): payload is AxiosError<T, D>;
|
||||||
toFormData(sourceObj: object, targetFormData?: GenericFormData, options?: FormSerializerOptions): GenericFormData;
|
toFormData(
|
||||||
|
sourceObj: object,
|
||||||
|
targetFormData?: GenericFormData,
|
||||||
|
options?: FormSerializerOptions
|
||||||
|
): GenericFormData;
|
||||||
formToJSON(form: GenericFormData | GenericHTMLFormElement): object;
|
formToJSON(form: GenericFormData | GenericHTMLFormElement): object;
|
||||||
getAdapter(adapters: AxiosAdapterConfig | AxiosAdapterConfig[] | undefined): AxiosAdapter;
|
getAdapter(adapters: AxiosAdapterConfig | AxiosAdapterConfig[] | undefined): AxiosAdapter;
|
||||||
AxiosHeaders: typeof AxiosHeaders;
|
AxiosHeaders: typeof AxiosHeaders;
|
||||||
mergeConfig<D = any>(config1: AxiosRequestConfig<D>, config2: AxiosRequestConfig<D>): AxiosRequestConfig<D>;
|
mergeConfig<D = any>(
|
||||||
|
config1: AxiosRequestConfig<D>,
|
||||||
|
config2: AxiosRequestConfig<D>
|
||||||
|
): AxiosRequestConfig<D>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ const {
|
|||||||
HttpStatusCode,
|
HttpStatusCode,
|
||||||
formToJSON,
|
formToJSON,
|
||||||
getAdapter,
|
getAdapter,
|
||||||
mergeConfig
|
mergeConfig,
|
||||||
} = axios;
|
} = axios;
|
||||||
|
|
||||||
export {
|
export {
|
||||||
@@ -39,5 +39,5 @@ export {
|
|||||||
HttpStatusCode,
|
HttpStatusCode,
|
||||||
formToJSON,
|
formToJSON,
|
||||||
getAdapter,
|
getAdapter,
|
||||||
mergeConfig
|
mergeConfig,
|
||||||
}
|
};
|
||||||
|
|||||||
+22
-48
@@ -14,7 +14,7 @@ function createCustomLauncher(browser, version, platform) {
|
|||||||
base: 'SauceLabs',
|
base: 'SauceLabs',
|
||||||
browserName: browser,
|
browserName: browser,
|
||||||
version: version,
|
version: version,
|
||||||
platform: platform
|
platform: platform,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ module.exports = function(config) {
|
|||||||
'SAUCE_IE',
|
'SAUCE_IE',
|
||||||
'SAUCE_EDGE',
|
'SAUCE_EDGE',
|
||||||
'SAUCE_IOS',
|
'SAUCE_IOS',
|
||||||
'SAUCE_ANDROID'
|
'SAUCE_ANDROID',
|
||||||
];
|
];
|
||||||
|
|
||||||
options.forEach(function (opt) {
|
options.forEach(function (opt) {
|
||||||
@@ -62,21 +62,9 @@ module.exports = function(config) {
|
|||||||
if (runAll || process.env.SAUCE_SAFARI) {
|
if (runAll || process.env.SAUCE_SAFARI) {
|
||||||
// customLaunchers.SL_Safari7 = createCustomLauncher('safari', 7);
|
// customLaunchers.SL_Safari7 = createCustomLauncher('safari', 7);
|
||||||
// customLaunchers.SL_Safari8 = createCustomLauncher('safari', 8);
|
// customLaunchers.SL_Safari8 = createCustomLauncher('safari', 8);
|
||||||
customLaunchers.SL_Safari9 = createCustomLauncher(
|
customLaunchers.SL_Safari9 = createCustomLauncher('safari', 9.0, 'OS X 10.11');
|
||||||
'safari',
|
customLaunchers.SL_Safari10 = createCustomLauncher('safari', '10.1', 'macOS 10.12');
|
||||||
9.0,
|
customLaunchers.SL_Safari11 = createCustomLauncher('safari', '11.1', 'macOS 10.13');
|
||||||
'OS X 10.11'
|
|
||||||
);
|
|
||||||
customLaunchers.SL_Safari10 = createCustomLauncher(
|
|
||||||
'safari',
|
|
||||||
'10.1',
|
|
||||||
'macOS 10.12'
|
|
||||||
);
|
|
||||||
customLaunchers.SL_Safari11 = createCustomLauncher(
|
|
||||||
'safari',
|
|
||||||
'11.1',
|
|
||||||
'macOS 10.13'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opera
|
// Opera
|
||||||
@@ -118,9 +106,9 @@ module.exports = function(config) {
|
|||||||
recordScreenshots: false,
|
recordScreenshots: false,
|
||||||
connectOptions: {
|
connectOptions: {
|
||||||
// port: 5757,
|
// port: 5757,
|
||||||
logfile: 'sauce_connect.log'
|
logfile: 'sauce_connect.log',
|
||||||
},
|
},
|
||||||
public: 'public'
|
public: 'public',
|
||||||
};
|
};
|
||||||
} else if (process.env.TRAVIS_PULL_REQUEST && process.env.TRAVIS_PULL_REQUEST !== 'false') {
|
} else if (process.env.TRAVIS_PULL_REQUEST && process.env.TRAVIS_PULL_REQUEST !== 'false') {
|
||||||
console.log(
|
console.log(
|
||||||
@@ -133,49 +121,43 @@ module.exports = function(config) {
|
|||||||
browsers = ['FirefoxHeadless', 'ChromeHeadless'];
|
browsers = ['FirefoxHeadless', 'ChromeHeadless'];
|
||||||
} else {
|
} else {
|
||||||
browsers = browsers || ['Chrome'];
|
browsers = browsers || ['Chrome'];
|
||||||
console.log(`Running ${browsers} locally since SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables are not set.`);
|
console.log(
|
||||||
|
`Running ${browsers} locally since SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables are not set.`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
config.set({
|
config.set({
|
||||||
// base path that will be used to resolve all patterns (eg. files, exclude)
|
// base path that will be used to resolve all patterns (eg. files, exclude)
|
||||||
basePath: '',
|
basePath: '',
|
||||||
|
|
||||||
|
|
||||||
// frameworks to use
|
// frameworks to use
|
||||||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
||||||
frameworks: ['jasmine-ajax', 'jasmine', 'sinon'],
|
frameworks: ['jasmine-ajax', 'jasmine', 'sinon'],
|
||||||
|
|
||||||
|
|
||||||
// list of files / patterns to load in the browser
|
// list of files / patterns to load in the browser
|
||||||
files: [
|
files: [
|
||||||
{ pattern: 'test/specs/__helpers.js', watched: false },
|
{ pattern: 'test/specs/__helpers.js', watched: false },
|
||||||
{pattern: 'test/specs/**/*.spec.js', watched: false}
|
{ pattern: 'test/specs/**/*.spec.js', watched: false },
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
// list of files to exclude
|
// list of files to exclude
|
||||||
exclude: [],
|
exclude: [],
|
||||||
|
|
||||||
|
|
||||||
// preprocess matching files before serving them to the browser
|
// preprocess matching files before serving them to the browser
|
||||||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
||||||
preprocessors: {
|
preprocessors: {
|
||||||
'test/specs/__helpers.js': ['rollup'],
|
'test/specs/__helpers.js': ['rollup'],
|
||||||
'test/specs/**/*.spec.js': ['rollup']
|
'test/specs/**/*.spec.js': ['rollup'],
|
||||||
},
|
},
|
||||||
|
|
||||||
rollupPreprocessor: {
|
rollupPreprocessor: {
|
||||||
plugins: [
|
plugins: [resolve({ browser: true }), commonjs()],
|
||||||
resolve({browser: true}),
|
|
||||||
commonjs()
|
|
||||||
],
|
|
||||||
output: {
|
output: {
|
||||||
format: 'iife',
|
format: 'iife',
|
||||||
name: '_axios',
|
name: '_axios',
|
||||||
sourcemap: 'inline'
|
sourcemap: 'inline',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
// test results reporter to use
|
// test results reporter to use
|
||||||
// possible values: 'dots', 'progress'
|
// possible values: 'dots', 'progress'
|
||||||
@@ -184,36 +166,29 @@ module.exports = function(config) {
|
|||||||
// reporters: ['dots', 'coverage', 'saucelabs'],
|
// reporters: ['dots', 'coverage', 'saucelabs'],
|
||||||
reporters: ['progress'],
|
reporters: ['progress'],
|
||||||
|
|
||||||
|
|
||||||
// web server port
|
// web server port
|
||||||
port: 9876,
|
port: 9876,
|
||||||
|
|
||||||
|
|
||||||
// Increase timeouts to prevent the issue with disconnected tests (https://goo.gl/nstA69)
|
// Increase timeouts to prevent the issue with disconnected tests (https://goo.gl/nstA69)
|
||||||
captureTimeout: 4 * 60 * 1000,
|
captureTimeout: 4 * 60 * 1000,
|
||||||
browserDisconnectTimeout: 10000,
|
browserDisconnectTimeout: 10000,
|
||||||
browserDisconnectTolerance: 1,
|
browserDisconnectTolerance: 1,
|
||||||
browserNoActivityTimeout: 4 * 60 * 1000,
|
browserNoActivityTimeout: 4 * 60 * 1000,
|
||||||
|
|
||||||
|
|
||||||
// enable / disable colors in the output (reporters and logs)
|
// enable / disable colors in the output (reporters and logs)
|
||||||
colors: true,
|
colors: true,
|
||||||
|
|
||||||
|
|
||||||
// level of logging
|
// level of logging
|
||||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||||
logLevel: config.LOG_INFO,
|
logLevel: config.LOG_INFO,
|
||||||
|
|
||||||
|
|
||||||
// enable / disable watching file and executing tests whenever any file changes
|
// enable / disable watching file and executing tests whenever any file changes
|
||||||
autoWatch: false,
|
autoWatch: false,
|
||||||
|
|
||||||
|
|
||||||
// start these browsers
|
// start these browsers
|
||||||
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
||||||
browsers: browsers,
|
browsers: browsers,
|
||||||
|
|
||||||
|
|
||||||
// Continuous Integration mode
|
// Continuous Integration mode
|
||||||
// if true, Karma captures browsers, runs the tests and exits
|
// if true, Karma captures browsers, runs the tests and exits
|
||||||
singleRun: false,
|
singleRun: false,
|
||||||
@@ -225,26 +200,25 @@ module.exports = function(config) {
|
|||||||
devtool: 'inline-source-map',
|
devtool: 'inline-source-map',
|
||||||
externals: [
|
externals: [
|
||||||
{
|
{
|
||||||
'./adapters/http': 'var undefined'
|
'./adapters/http': 'var undefined',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
webpackServer: {
|
webpackServer: {
|
||||||
stats: {
|
stats: {
|
||||||
colors: true
|
colors: true,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
// Coverage reporting
|
// Coverage reporting
|
||||||
coverageReporter: {
|
coverageReporter: {
|
||||||
type: 'lcov',
|
type: 'lcov',
|
||||||
dir: 'coverage/',
|
dir: 'coverage/',
|
||||||
subdir: '.'
|
subdir: '.',
|
||||||
},
|
},
|
||||||
|
|
||||||
sauceLabs: sauceLabs,
|
sauceLabs: sauceLabs,
|
||||||
customLaunchers: customLaunchers
|
customLaunchers: customLaunchers,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,14 +17,13 @@ module.exports = function myAdapter(config) {
|
|||||||
// Upon response settle the Promise
|
// Upon response settle the Promise
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
|
|
||||||
var response = {
|
var response = {
|
||||||
data: responseData,
|
data: responseData,
|
||||||
status: request.status,
|
status: request.status,
|
||||||
statusText: request.statusText,
|
statusText: request.statusText,
|
||||||
headers: responseHeaders,
|
headers: responseHeaders,
|
||||||
config: config,
|
config: config,
|
||||||
request: request
|
request: request,
|
||||||
};
|
};
|
||||||
|
|
||||||
settle(resolve, reject, response);
|
settle(resolve, reject, response);
|
||||||
@@ -33,5 +32,5 @@ module.exports = function myAdapter(config) {
|
|||||||
// - response transformers will run
|
// - response transformers will run
|
||||||
// - response interceptors will run
|
// - response interceptors will run
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import utils from '../utils.js';
|
|||||||
import httpAdapter from './http.js';
|
import httpAdapter from './http.js';
|
||||||
import xhrAdapter from './xhr.js';
|
import xhrAdapter from './xhr.js';
|
||||||
import * as fetchAdapter from './fetch.js';
|
import * as fetchAdapter from './fetch.js';
|
||||||
import AxiosError from "../core/AxiosError.js";
|
import AxiosError from '../core/AxiosError.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Known adapters mapping.
|
* Known adapters mapping.
|
||||||
@@ -18,7 +18,7 @@ const knownAdapters = {
|
|||||||
xhr: xhrAdapter,
|
xhr: xhrAdapter,
|
||||||
fetch: {
|
fetch: {
|
||||||
get: fetchAdapter.getFetch,
|
get: fetchAdapter.getFetch,
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Assign adapter names for easier debugging and identification
|
// Assign adapter names for easier debugging and identification
|
||||||
@@ -47,7 +47,8 @@ const renderReason = (reason) => `- ${reason}`;
|
|||||||
* @param {Function|null|false} adapter
|
* @param {Function|null|false} adapter
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;
|
const isResolvedHandle = (adapter) =>
|
||||||
|
utils.isFunction(adapter) || adapter === null || adapter === false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the first suitable adapter from the provided list.
|
* Get the first suitable adapter from the provided list.
|
||||||
@@ -90,14 +91,17 @@ function getAdapter(adapters, config) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!adapter) {
|
if (!adapter) {
|
||||||
const reasons = Object.entries(rejectedReasons)
|
const reasons = Object.entries(rejectedReasons).map(
|
||||||
.map(([id, state]) => `adapter ${id} ` +
|
([id, state]) =>
|
||||||
|
`adapter ${id} ` +
|
||||||
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
||||||
);
|
);
|
||||||
|
|
||||||
let s = length ?
|
let s = length
|
||||||
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
|
? reasons.length > 1
|
||||||
'as no adapter specified';
|
? 'since :\n' + reasons.map(renderReason).join('\n')
|
||||||
|
: ' ' + renderReason(reasons[0])
|
||||||
|
: 'as no adapter specified';
|
||||||
|
|
||||||
throw new AxiosError(
|
throw new AxiosError(
|
||||||
`There is no suitable adapter to dispatch the request ` + s,
|
`There is no suitable adapter to dispatch the request ` + s,
|
||||||
@@ -122,5 +126,5 @@ export default {
|
|||||||
* Exposes all known adapters
|
* Exposes all known adapters
|
||||||
* @type {Object<string, Function|Object>}
|
* @type {Object<string, Function|Object>}
|
||||||
*/
|
*/
|
||||||
adapters: knownAdapters
|
adapters: knownAdapters,
|
||||||
};
|
};
|
||||||
|
|||||||
+109
-63
@@ -1,38 +1,44 @@
|
|||||||
import platform from "../platform/index.js";
|
import platform from '../platform/index.js';
|
||||||
import utils from "../utils.js";
|
import utils from '../utils.js';
|
||||||
import AxiosError from "../core/AxiosError.js";
|
import AxiosError from '../core/AxiosError.js';
|
||||||
import composeSignals from "../helpers/composeSignals.js";
|
import composeSignals from '../helpers/composeSignals.js';
|
||||||
import {trackStream} from "../helpers/trackStream.js";
|
import { trackStream } from '../helpers/trackStream.js';
|
||||||
import AxiosHeaders from "../core/AxiosHeaders.js";
|
import AxiosHeaders from '../core/AxiosHeaders.js';
|
||||||
import {progressEventReducer, progressEventDecorator, asyncDecorator} from "../helpers/progressEventReducer.js";
|
import {
|
||||||
import resolveConfig from "../helpers/resolveConfig.js";
|
progressEventReducer,
|
||||||
import settle from "../core/settle.js";
|
progressEventDecorator,
|
||||||
|
asyncDecorator,
|
||||||
|
} from '../helpers/progressEventReducer.js';
|
||||||
|
import resolveConfig from '../helpers/resolveConfig.js';
|
||||||
|
import settle from '../core/settle.js';
|
||||||
|
|
||||||
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
||||||
|
|
||||||
const { isFunction } = utils;
|
const { isFunction } = utils;
|
||||||
|
|
||||||
const globalFetchAPI = (({ Request, Response }) => ({
|
const globalFetchAPI = (({ Request, Response }) => ({
|
||||||
Request, Response
|
Request,
|
||||||
|
Response,
|
||||||
}))(utils.global);
|
}))(utils.global);
|
||||||
|
|
||||||
const {
|
const { ReadableStream, TextEncoder } = utils.global;
|
||||||
ReadableStream, TextEncoder
|
|
||||||
} = utils.global;
|
|
||||||
|
|
||||||
|
|
||||||
const test = (fn, ...args) => {
|
const test = (fn, ...args) => {
|
||||||
try {
|
try {
|
||||||
return !!fn(...args);
|
return !!fn(...args);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return false
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const factory = (env) => {
|
const factory = (env) => {
|
||||||
env = utils.merge.call({
|
env = utils.merge.call(
|
||||||
skipUndefined: true
|
{
|
||||||
}, globalFetchAPI, env);
|
skipUndefined: true,
|
||||||
|
},
|
||||||
|
globalFetchAPI,
|
||||||
|
env
|
||||||
|
);
|
||||||
|
|
||||||
const { fetch: envFetch, Request, Response } = env;
|
const { fetch: envFetch, Request, Response } = env;
|
||||||
const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
|
const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
|
||||||
@@ -45,12 +51,19 @@ const factory = (env) => {
|
|||||||
|
|
||||||
const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream);
|
const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream);
|
||||||
|
|
||||||
const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
|
const encodeText =
|
||||||
((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
|
isFetchSupported &&
|
||||||
async (str) => new Uint8Array(await new Request(str).arrayBuffer())
|
(typeof TextEncoder === 'function'
|
||||||
);
|
? (
|
||||||
|
(encoder) => (str) =>
|
||||||
|
encoder.encode(str)
|
||||||
|
)(new TextEncoder())
|
||||||
|
: async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
|
||||||
|
|
||||||
const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
|
const supportsRequestStream =
|
||||||
|
isRequestSupported &&
|
||||||
|
isReadableStreamSupported &&
|
||||||
|
test(() => {
|
||||||
let duplexAccessed = false;
|
let duplexAccessed = false;
|
||||||
|
|
||||||
const hasContentType = new Request(platform.origin, {
|
const hasContentType = new Request(platform.origin, {
|
||||||
@@ -65,26 +78,34 @@ const factory = (env) => {
|
|||||||
return duplexAccessed && !hasContentType;
|
return duplexAccessed && !hasContentType;
|
||||||
});
|
});
|
||||||
|
|
||||||
const supportsResponseStream = isResponseSupported && isReadableStreamSupported &&
|
const supportsResponseStream =
|
||||||
|
isResponseSupported &&
|
||||||
|
isReadableStreamSupported &&
|
||||||
test(() => utils.isReadableStream(new Response('').body));
|
test(() => utils.isReadableStream(new Response('').body));
|
||||||
|
|
||||||
const resolvers = {
|
const resolvers = {
|
||||||
stream: supportsResponseStream && ((res) => res.body)
|
stream: supportsResponseStream && ((res) => res.body),
|
||||||
};
|
};
|
||||||
|
|
||||||
isFetchSupported && ((() => {
|
isFetchSupported &&
|
||||||
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
|
(() => {
|
||||||
!resolvers[type] && (resolvers[type] = (res, config) => {
|
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach((type) => {
|
||||||
|
!resolvers[type] &&
|
||||||
|
(resolvers[type] = (res, config) => {
|
||||||
let method = res && res[type];
|
let method = res && res[type];
|
||||||
|
|
||||||
if (method) {
|
if (method) {
|
||||||
return method.call(res);
|
return method.call(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
|
throw new AxiosError(
|
||||||
})
|
`Response type '${type}' is not supported`,
|
||||||
|
AxiosError.ERR_NOT_SUPPORT,
|
||||||
|
config
|
||||||
|
);
|
||||||
});
|
});
|
||||||
})());
|
});
|
||||||
|
})();
|
||||||
|
|
||||||
const getBodyLength = async (body) => {
|
const getBodyLength = async (body) => {
|
||||||
if (body == null) {
|
if (body == null) {
|
||||||
@@ -114,13 +135,13 @@ const factory = (env) => {
|
|||||||
if (utils.isString(body)) {
|
if (utils.isString(body)) {
|
||||||
return (await encodeText(body)).byteLength;
|
return (await encodeText(body)).byteLength;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
const resolveBodyLength = async (headers, body) => {
|
const resolveBodyLength = async (headers, body) => {
|
||||||
const length = utils.toFiniteNumber(headers.getContentLength());
|
const length = utils.toFiniteNumber(headers.getContentLength());
|
||||||
|
|
||||||
return length == null ? getBodyLength(body) : length;
|
return length == null ? getBodyLength(body) : length;
|
||||||
}
|
};
|
||||||
|
|
||||||
return async (config) => {
|
return async (config) => {
|
||||||
let {
|
let {
|
||||||
@@ -135,18 +156,24 @@ const factory = (env) => {
|
|||||||
responseType,
|
responseType,
|
||||||
headers,
|
headers,
|
||||||
withCredentials = 'same-origin',
|
withCredentials = 'same-origin',
|
||||||
fetchOptions
|
fetchOptions,
|
||||||
} = resolveConfig(config);
|
} = resolveConfig(config);
|
||||||
|
|
||||||
let _fetch = envFetch || fetch;
|
let _fetch = envFetch || fetch;
|
||||||
|
|
||||||
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
||||||
|
|
||||||
let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
let composedSignal = composeSignals(
|
||||||
|
[signal, cancelToken && cancelToken.toAbortSignal()],
|
||||||
|
timeout
|
||||||
|
);
|
||||||
|
|
||||||
let request = null;
|
let request = null;
|
||||||
|
|
||||||
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
const unsubscribe =
|
||||||
|
composedSignal &&
|
||||||
|
composedSignal.unsubscribe &&
|
||||||
|
(() => {
|
||||||
composedSignal.unsubscribe();
|
composedSignal.unsubscribe();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -154,19 +181,22 @@ const factory = (env) => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (
|
if (
|
||||||
onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
|
onUploadProgress &&
|
||||||
|
supportsRequestStream &&
|
||||||
|
method !== 'get' &&
|
||||||
|
method !== 'head' &&
|
||||||
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
||||||
) {
|
) {
|
||||||
let _request = new Request(url, {
|
let _request = new Request(url, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: data,
|
body: data,
|
||||||
duplex: "half"
|
duplex: 'half',
|
||||||
});
|
});
|
||||||
|
|
||||||
let contentTypeHeader;
|
let contentTypeHeader;
|
||||||
|
|
||||||
if (utils.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
|
if (utils.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
|
||||||
headers.setContentType(contentTypeHeader)
|
headers.setContentType(contentTypeHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_request.body) {
|
if (_request.body) {
|
||||||
@@ -185,7 +215,7 @@ const factory = (env) => {
|
|||||||
|
|
||||||
// Cloudflare Workers throws when credentials are defined
|
// Cloudflare Workers throws when credentials are defined
|
||||||
// see https://github.com/cloudflare/workerd/issues/902
|
// see https://github.com/cloudflare/workerd/issues/902
|
||||||
const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
|
const isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;
|
||||||
|
|
||||||
const resolvedOptions = {
|
const resolvedOptions = {
|
||||||
...fetchOptions,
|
...fetchOptions,
|
||||||
@@ -193,29 +223,35 @@ const factory = (env) => {
|
|||||||
method: method.toUpperCase(),
|
method: method.toUpperCase(),
|
||||||
headers: headers.normalize().toJSON(),
|
headers: headers.normalize().toJSON(),
|
||||||
body: data,
|
body: data,
|
||||||
duplex: "half",
|
duplex: 'half',
|
||||||
credentials: isCredentialsSupported ? withCredentials : undefined
|
credentials: isCredentialsSupported ? withCredentials : undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
request = isRequestSupported && new Request(url, resolvedOptions);
|
request = isRequestSupported && new Request(url, resolvedOptions);
|
||||||
|
|
||||||
let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
|
let response = await (isRequestSupported
|
||||||
|
? _fetch(request, fetchOptions)
|
||||||
|
: _fetch(url, resolvedOptions));
|
||||||
|
|
||||||
const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
const isStreamResponse =
|
||||||
|
supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
||||||
|
|
||||||
if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
|
if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
|
||||||
const options = {};
|
const options = {};
|
||||||
|
|
||||||
['status', 'statusText', 'headers'].forEach(prop => {
|
['status', 'statusText', 'headers'].forEach((prop) => {
|
||||||
options[prop] = response[prop];
|
options[prop] = response[prop];
|
||||||
});
|
});
|
||||||
|
|
||||||
const responseContentLength = utils.toFiniteNumber(response.headers.get('content-length'));
|
const responseContentLength = utils.toFiniteNumber(response.headers.get('content-length'));
|
||||||
|
|
||||||
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
const [onProgress, flush] =
|
||||||
|
(onDownloadProgress &&
|
||||||
|
progressEventDecorator(
|
||||||
responseContentLength,
|
responseContentLength,
|
||||||
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
||||||
) || [];
|
)) ||
|
||||||
|
[];
|
||||||
|
|
||||||
response = new Response(
|
response = new Response(
|
||||||
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
||||||
@@ -228,7 +264,10 @@ const factory = (env) => {
|
|||||||
|
|
||||||
responseType = responseType || 'text';
|
responseType = responseType || 'text';
|
||||||
|
|
||||||
let responseData = await resolvers[utils.findKey(resolvers, responseType) || 'text'](response, config);
|
let responseData = await resolvers[utils.findKey(resolvers, responseType) || 'text'](
|
||||||
|
response,
|
||||||
|
config
|
||||||
|
);
|
||||||
|
|
||||||
!isStreamResponse && unsubscribe && unsubscribe();
|
!isStreamResponse && unsubscribe && unsubscribe();
|
||||||
|
|
||||||
@@ -239,43 +278,50 @@ const factory = (env) => {
|
|||||||
status: response.status,
|
status: response.status,
|
||||||
statusText: response.statusText,
|
statusText: response.statusText,
|
||||||
config,
|
config,
|
||||||
request
|
request,
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
unsubscribe && unsubscribe();
|
unsubscribe && unsubscribe();
|
||||||
|
|
||||||
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
||||||
throw Object.assign(
|
throw Object.assign(
|
||||||
new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request, err && err.response),
|
new AxiosError(
|
||||||
|
'Network Error',
|
||||||
|
AxiosError.ERR_NETWORK,
|
||||||
|
config,
|
||||||
|
request,
|
||||||
|
err && err.response
|
||||||
|
),
|
||||||
{
|
{
|
||||||
cause: err.cause || err
|
cause: err.cause || err,
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw AxiosError.from(err, err && err.code, config, request, err && err.response);
|
throw AxiosError.from(err, err && err.code, config, request, err && err.response);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
const seedCache = new Map();
|
const seedCache = new Map();
|
||||||
|
|
||||||
export const getFetch = (config) => {
|
export const getFetch = (config) => {
|
||||||
let env = (config && config.env) || {};
|
let env = (config && config.env) || {};
|
||||||
const { fetch, Request, Response } = env;
|
const { fetch, Request, Response } = env;
|
||||||
const seeds = [
|
const seeds = [Request, Response, fetch];
|
||||||
Request, Response, fetch
|
|
||||||
];
|
|
||||||
|
|
||||||
let len = seeds.length, i = len,
|
let len = seeds.length,
|
||||||
seed, target, map = seedCache;
|
i = len,
|
||||||
|
seed,
|
||||||
|
target,
|
||||||
|
map = seedCache;
|
||||||
|
|
||||||
while (i--) {
|
while (i--) {
|
||||||
seed = seeds[i];
|
seed = seeds[i];
|
||||||
target = map.get(seed);
|
target = map.get(seed);
|
||||||
|
|
||||||
target === undefined && map.set(seed, target = (i ? new Map() : factory(env)))
|
target === undefined && map.set(seed, (target = i ? new Map() : factory(env)));
|
||||||
|
|
||||||
map = target;
|
map = target;
|
||||||
}
|
}
|
||||||
|
|||||||
+157
-106
@@ -19,22 +19,26 @@ import stream from 'stream';
|
|||||||
import AxiosHeaders from '../core/AxiosHeaders.js';
|
import AxiosHeaders from '../core/AxiosHeaders.js';
|
||||||
import AxiosTransformStream from '../helpers/AxiosTransformStream.js';
|
import AxiosTransformStream from '../helpers/AxiosTransformStream.js';
|
||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
import formDataToStream from "../helpers/formDataToStream.js";
|
import formDataToStream from '../helpers/formDataToStream.js';
|
||||||
import readBlob from "../helpers/readBlob.js";
|
import readBlob from '../helpers/readBlob.js';
|
||||||
import ZlibHeaderTransformStream from '../helpers/ZlibHeaderTransformStream.js';
|
import ZlibHeaderTransformStream from '../helpers/ZlibHeaderTransformStream.js';
|
||||||
import callbackify from "../helpers/callbackify.js";
|
import callbackify from '../helpers/callbackify.js';
|
||||||
import {progressEventReducer, progressEventDecorator, asyncDecorator} from "../helpers/progressEventReducer.js";
|
import {
|
||||||
|
progressEventReducer,
|
||||||
|
progressEventDecorator,
|
||||||
|
asyncDecorator,
|
||||||
|
} from '../helpers/progressEventReducer.js';
|
||||||
import estimateDataURLDecodedBytes from '../helpers/estimateDataURLDecodedBytes.js';
|
import estimateDataURLDecodedBytes from '../helpers/estimateDataURLDecodedBytes.js';
|
||||||
|
|
||||||
const zlibOptions = {
|
const zlibOptions = {
|
||||||
flush: zlib.constants.Z_SYNC_FLUSH,
|
flush: zlib.constants.Z_SYNC_FLUSH,
|
||||||
finishFlush: zlib.constants.Z_SYNC_FLUSH
|
finishFlush: zlib.constants.Z_SYNC_FLUSH,
|
||||||
};
|
};
|
||||||
|
|
||||||
const brotliOptions = {
|
const brotliOptions = {
|
||||||
flush: zlib.constants.BROTLI_OPERATION_FLUSH,
|
flush: zlib.constants.BROTLI_OPERATION_FLUSH,
|
||||||
finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH
|
finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH,
|
||||||
}
|
};
|
||||||
|
|
||||||
const isBrotliSupported = utils.isFunction(zlib.createBrotliDecompress);
|
const isBrotliSupported = utils.isFunction(zlib.createBrotliDecompress);
|
||||||
|
|
||||||
@@ -42,18 +46,15 @@ const {http: httpFollow, https: httpsFollow} = followRedirects;
|
|||||||
|
|
||||||
const isHttps = /https:?/;
|
const isHttps = /https:?/;
|
||||||
|
|
||||||
const supportedProtocols = platform.protocols.map(protocol => {
|
const supportedProtocols = platform.protocols.map((protocol) => {
|
||||||
return protocol + ':';
|
return protocol + ':';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
const flushOnFinish = (stream, [throttled, flush]) => {
|
const flushOnFinish = (stream, [throttled, flush]) => {
|
||||||
stream
|
stream.on('end', flush).on('error', flush);
|
||||||
.on('end', flush)
|
|
||||||
.on('error', flush);
|
|
||||||
|
|
||||||
return throttled;
|
return throttled;
|
||||||
}
|
};
|
||||||
|
|
||||||
class Http2Sessions {
|
class Http2Sessions {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -61,9 +62,12 @@ class Http2Sessions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getSession(authority, options) {
|
getSession(authority, options) {
|
||||||
options = Object.assign({
|
options = Object.assign(
|
||||||
sessionTimeout: 1000
|
{
|
||||||
}, options);
|
sessionTimeout: 1000,
|
||||||
|
},
|
||||||
|
options
|
||||||
|
);
|
||||||
|
|
||||||
let authoritySessions = this.sessions[authority];
|
let authoritySessions = this.sessions[authority];
|
||||||
|
|
||||||
@@ -72,7 +76,11 @@ class Http2Sessions {
|
|||||||
|
|
||||||
for (let i = 0; i < len; i++) {
|
for (let i = 0; i < len; i++) {
|
||||||
const [sessionHandle, sessionOptions] = authoritySessions[i];
|
const [sessionHandle, sessionOptions] = authoritySessions[i];
|
||||||
if (!sessionHandle.destroyed && !sessionHandle.closed && util.isDeepStrictEqual(sessionOptions, options)) {
|
if (
|
||||||
|
!sessionHandle.destroyed &&
|
||||||
|
!sessionHandle.closed &&
|
||||||
|
util.isDeepStrictEqual(sessionOptions, options)
|
||||||
|
) {
|
||||||
return sessionHandle;
|
return sessionHandle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -89,7 +97,9 @@ class Http2Sessions {
|
|||||||
|
|
||||||
removed = true;
|
removed = true;
|
||||||
|
|
||||||
let entries = authoritySessions, len = entries.length, i = len;
|
let entries = authoritySessions,
|
||||||
|
len = entries.length,
|
||||||
|
i = len;
|
||||||
|
|
||||||
while (i--) {
|
while (i--) {
|
||||||
if (entries[i][0] === session) {
|
if (entries[i][0] === session) {
|
||||||
@@ -108,7 +118,6 @@ class Http2Sessions {
|
|||||||
const { sessionTimeout } = options;
|
const { sessionTimeout } = options;
|
||||||
|
|
||||||
if (sessionTimeout != null) {
|
if (sessionTimeout != null) {
|
||||||
|
|
||||||
let timer;
|
let timer;
|
||||||
let streamsCount = 0;
|
let streamsCount = 0;
|
||||||
|
|
||||||
@@ -132,17 +141,16 @@ class Http2Sessions {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return stream;
|
return stream;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
session.once('close', removeSession);
|
session.once('close', removeSession);
|
||||||
|
|
||||||
let entry = [
|
let entry = [session, options];
|
||||||
session,
|
|
||||||
options
|
|
||||||
];
|
|
||||||
|
|
||||||
authoritySessions ? authoritySessions.push(entry) : authoritySessions = this.sessions[authority] = [entry];
|
authoritySessions
|
||||||
|
? authoritySessions.push(entry)
|
||||||
|
: (authoritySessions = this.sessions[authority] = [entry]);
|
||||||
|
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
@@ -150,7 +158,6 @@ class Http2Sessions {
|
|||||||
|
|
||||||
const http2Sessions = new Http2Sessions();
|
const http2Sessions = new Http2Sessions();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the proxy or config beforeRedirects functions are defined, call them with the options
|
* If the proxy or config beforeRedirects functions are defined, call them with the options
|
||||||
* object.
|
* object.
|
||||||
@@ -225,7 +232,8 @@ function setProxy(options, configProxy, location) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(process) === 'process';
|
const isHttpAdapterSupported =
|
||||||
|
typeof process !== 'undefined' && utils.kindOf(process) === 'process';
|
||||||
|
|
||||||
// temporary hotfix
|
// temporary hotfix
|
||||||
|
|
||||||
@@ -238,7 +246,7 @@ const wrapAsync = (asyncExecutor) => {
|
|||||||
if (isDone) return;
|
if (isDone) return;
|
||||||
isDone = true;
|
isDone = true;
|
||||||
onDone && onDone(value, isRejected);
|
onDone && onDone(value, isRejected);
|
||||||
}
|
};
|
||||||
|
|
||||||
const _resolve = (value) => {
|
const _resolve = (value) => {
|
||||||
done(value);
|
done(value);
|
||||||
@@ -248,45 +256,46 @@ const wrapAsync = (asyncExecutor) => {
|
|||||||
const _reject = (reason) => {
|
const _reject = (reason) => {
|
||||||
done(reason, true);
|
done(reason, true);
|
||||||
reject(reason);
|
reject(reason);
|
||||||
}
|
};
|
||||||
|
|
||||||
asyncExecutor(_resolve, _reject, (onDoneHandler) => (onDone = onDoneHandler)).catch(_reject);
|
asyncExecutor(_resolve, _reject, (onDoneHandler) => (onDone = onDoneHandler)).catch(_reject);
|
||||||
})
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const resolveFamily = ({ address, family }) => {
|
const resolveFamily = ({ address, family }) => {
|
||||||
if (!utils.isString(address)) {
|
if (!utils.isString(address)) {
|
||||||
throw TypeError('address must be a string');
|
throw TypeError('address must be a string');
|
||||||
}
|
}
|
||||||
return ({
|
return {
|
||||||
address,
|
address,
|
||||||
family: family || (address.indexOf('.') < 0 ? 6 : 4)
|
family: family || (address.indexOf('.') < 0 ? 6 : 4),
|
||||||
});
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
const buildAddressEntry = (address, family) => resolveFamily(utils.isObject(address) ? address : {address, family});
|
const buildAddressEntry = (address, family) =>
|
||||||
|
resolveFamily(utils.isObject(address) ? address : { address, family });
|
||||||
|
|
||||||
const http2Transport = {
|
const http2Transport = {
|
||||||
request(options, cb) {
|
request(options, cb) {
|
||||||
const authority = options.protocol + '//' + options.hostname + ':' + (options.port ||(options.protocol === 'https:' ? 443 : 80));
|
const authority =
|
||||||
|
options.protocol +
|
||||||
|
'//' +
|
||||||
|
options.hostname +
|
||||||
|
':' +
|
||||||
|
(options.port || (options.protocol === 'https:' ? 443 : 80));
|
||||||
|
|
||||||
const { http2Options, headers } = options;
|
const { http2Options, headers } = options;
|
||||||
|
|
||||||
const session = http2Sessions.getSession(authority, http2Options);
|
const session = http2Sessions.getSession(authority, http2Options);
|
||||||
|
|
||||||
const {
|
const { HTTP2_HEADER_SCHEME, HTTP2_HEADER_METHOD, HTTP2_HEADER_PATH, HTTP2_HEADER_STATUS } =
|
||||||
HTTP2_HEADER_SCHEME,
|
http2.constants;
|
||||||
HTTP2_HEADER_METHOD,
|
|
||||||
HTTP2_HEADER_PATH,
|
|
||||||
HTTP2_HEADER_STATUS
|
|
||||||
} = http2.constants;
|
|
||||||
|
|
||||||
const http2Headers = {
|
const http2Headers = {
|
||||||
[HTTP2_HEADER_SCHEME]: options.protocol.replace(':', ''),
|
[HTTP2_HEADER_SCHEME]: options.protocol.replace(':', ''),
|
||||||
[HTTP2_HEADER_METHOD]: options.method,
|
[HTTP2_HEADER_METHOD]: options.method,
|
||||||
[HTTP2_HEADER_PATH]: options.path,
|
[HTTP2_HEADER_PATH]: options.path,
|
||||||
}
|
};
|
||||||
|
|
||||||
utils.forEach(headers, (header, name) => {
|
utils.forEach(headers, (header, name) => {
|
||||||
name.charAt(0) !== ':' && (http2Headers[name] = header);
|
name.charAt(0) !== ':' && (http2Headers[name] = header);
|
||||||
@@ -308,14 +317,15 @@ const http2Transport = {
|
|||||||
response.statusCode = +status;
|
response.statusCode = +status;
|
||||||
|
|
||||||
cb(response);
|
cb(response);
|
||||||
})
|
});
|
||||||
|
|
||||||
return req;
|
return req;
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
|
|
||||||
/*eslint consistent-return:0*/
|
/*eslint consistent-return:0*/
|
||||||
export default isHttpAdapterSupported && function httpAdapter(config) {
|
export default isHttpAdapterSupported &&
|
||||||
|
function httpAdapter(config) {
|
||||||
return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
|
return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
|
||||||
let { data, lookup, family, httpVersion = 1, http2Options } = config;
|
let { data, lookup, family, httpVersion = 1, http2Options } = config;
|
||||||
const { responseType, responseEncoding } = config;
|
const { responseType, responseEncoding } = config;
|
||||||
@@ -337,7 +347,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|||||||
const isHttp2 = httpVersion === 2;
|
const isHttp2 = httpVersion === 2;
|
||||||
|
|
||||||
if (lookup) {
|
if (lookup) {
|
||||||
const _lookup = callbackify(lookup, (value) => utils.isArray(value) ? value : [value]);
|
const _lookup = callbackify(lookup, (value) => (utils.isArray(value) ? value : [value]));
|
||||||
// hotfix to support opt.all option which is required for node 20.x
|
// hotfix to support opt.all option which is required for node 20.x
|
||||||
lookup = (hostname, opt, cb) => {
|
lookup = (hostname, opt, cb) => {
|
||||||
_lookup(hostname, opt, (err, arg0, arg1) => {
|
_lookup(hostname, opt, (err, arg0, arg1) => {
|
||||||
@@ -345,18 +355,23 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|||||||
return cb(err);
|
return cb(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
const addresses = utils.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
|
const addresses = utils.isArray(arg0)
|
||||||
|
? arg0.map((addr) => buildAddressEntry(addr))
|
||||||
|
: [buildAddressEntry(arg0, arg1)];
|
||||||
|
|
||||||
opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
|
opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const abortEmitter = new EventEmitter();
|
const abortEmitter = new EventEmitter();
|
||||||
|
|
||||||
function abort(reason) {
|
function abort(reason) {
|
||||||
try {
|
try {
|
||||||
abortEmitter.emit('abort', !reason || reason.type ? new CanceledError(null, config, req) : reason);
|
abortEmitter.emit(
|
||||||
|
'abort',
|
||||||
|
!reason || reason.type ? new CanceledError(null, config, req) : reason
|
||||||
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.warn('emit error', err);
|
console.warn('emit error', err);
|
||||||
}
|
}
|
||||||
@@ -374,7 +389,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
abortEmitter.removeAllListeners();
|
abortEmitter.removeAllListeners();
|
||||||
}
|
};
|
||||||
|
|
||||||
if (config.cancelToken || config.signal) {
|
if (config.cancelToken || config.signal) {
|
||||||
config.cancelToken && config.cancelToken.subscribe(abort);
|
config.cancelToken && config.cancelToken.subscribe(abort);
|
||||||
@@ -404,10 +419,6 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Parse url
|
// Parse url
|
||||||
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
|
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
|
||||||
const parsed = new URL(fullPath, platform.hasBrowserEnv ? platform.origin : undefined);
|
const parsed = new URL(fullPath, platform.hasBrowserEnv ? platform.origin : undefined);
|
||||||
@@ -421,11 +432,13 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|||||||
const estimated = estimateDataURLDecodedBytes(dataUrl);
|
const estimated = estimateDataURLDecodedBytes(dataUrl);
|
||||||
|
|
||||||
if (estimated > config.maxContentLength) {
|
if (estimated > config.maxContentLength) {
|
||||||
return reject(new AxiosError(
|
return reject(
|
||||||
|
new AxiosError(
|
||||||
'maxContentLength size of ' + config.maxContentLength + ' exceeded',
|
'maxContentLength size of ' + config.maxContentLength + ' exceeded',
|
||||||
AxiosError.ERR_BAD_RESPONSE,
|
AxiosError.ERR_BAD_RESPONSE,
|
||||||
config
|
config
|
||||||
));
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,13 +449,13 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|||||||
status: 405,
|
status: 405,
|
||||||
statusText: 'method not allowed',
|
statusText: 'method not allowed',
|
||||||
headers: {},
|
headers: {},
|
||||||
config
|
config,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
convertedData = fromDataURI(config.url, responseType === 'blob', {
|
convertedData = fromDataURI(config.url, responseType === 'blob', {
|
||||||
Blob: config.env && config.env.Blob
|
Blob: config.env && config.env.Blob,
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config);
|
throw AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config);
|
||||||
@@ -463,16 +476,14 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|||||||
status: 200,
|
status: 200,
|
||||||
statusText: 'OK',
|
statusText: 'OK',
|
||||||
headers: new AxiosHeaders(),
|
headers: new AxiosHeaders(),
|
||||||
config
|
config,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (supportedProtocols.indexOf(protocol) === -1) {
|
if (supportedProtocols.indexOf(protocol) === -1) {
|
||||||
return reject(new AxiosError(
|
return reject(
|
||||||
'Unsupported protocol ' + protocol,
|
new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_BAD_REQUEST, config)
|
||||||
AxiosError.ERR_BAD_REQUEST,
|
);
|
||||||
config
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const headers = AxiosHeaders.from(config.headers).normalize();
|
const headers = AxiosHeaders.from(config.headers).normalize();
|
||||||
@@ -492,12 +503,16 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|||||||
if (utils.isSpecCompliantForm(data)) {
|
if (utils.isSpecCompliantForm(data)) {
|
||||||
const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i);
|
const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i);
|
||||||
|
|
||||||
data = formDataToStream(data, (formHeaders) => {
|
data = formDataToStream(
|
||||||
|
data,
|
||||||
|
(formHeaders) => {
|
||||||
headers.set(formHeaders);
|
headers.set(formHeaders);
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
tag: `axios-${VERSION}-boundary`,
|
tag: `axios-${VERSION}-boundary`,
|
||||||
boundary: userBoundary && userBoundary[1] || undefined
|
boundary: (userBoundary && userBoundary[1]) || undefined,
|
||||||
});
|
}
|
||||||
|
);
|
||||||
// support for https://www.npmjs.com/package/form-data api
|
// support for https://www.npmjs.com/package/form-data api
|
||||||
} else if (utils.isFormData(data) && utils.isFunction(data.getHeaders)) {
|
} else if (utils.isFormData(data) && utils.isFunction(data.getHeaders)) {
|
||||||
headers.set(data.getHeaders());
|
headers.set(data.getHeaders());
|
||||||
@@ -505,10 +520,11 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|||||||
if (!headers.hasContentLength()) {
|
if (!headers.hasContentLength()) {
|
||||||
try {
|
try {
|
||||||
const knownLength = await util.promisify(data.getLength).call(data);
|
const knownLength = await util.promisify(data.getLength).call(data);
|
||||||
Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength);
|
Number.isFinite(knownLength) &&
|
||||||
|
knownLength >= 0 &&
|
||||||
|
headers.setContentLength(knownLength);
|
||||||
/*eslint no-empty:0*/
|
/*eslint no-empty:0*/
|
||||||
} catch (e) {
|
} catch (e) {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (utils.isBlob(data) || utils.isFile(data)) {
|
} else if (utils.isBlob(data) || utils.isFile(data)) {
|
||||||
data.size && headers.setContentType(data.type || 'application/octet-stream');
|
data.size && headers.setContentType(data.type || 'application/octet-stream');
|
||||||
@@ -522,22 +538,26 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|||||||
} else if (utils.isString(data)) {
|
} else if (utils.isString(data)) {
|
||||||
data = Buffer.from(data, 'utf-8');
|
data = Buffer.from(data, 'utf-8');
|
||||||
} else {
|
} else {
|
||||||
return reject(new AxiosError(
|
return reject(
|
||||||
|
new AxiosError(
|
||||||
'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',
|
'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',
|
||||||
AxiosError.ERR_BAD_REQUEST,
|
AxiosError.ERR_BAD_REQUEST,
|
||||||
config
|
config
|
||||||
));
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add Content-Length header if data exists
|
// Add Content-Length header if data exists
|
||||||
headers.setContentLength(data.length, false);
|
headers.setContentLength(data.length, false);
|
||||||
|
|
||||||
if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {
|
if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {
|
||||||
return reject(new AxiosError(
|
return reject(
|
||||||
|
new AxiosError(
|
||||||
'Request body larger than maxBodyLength limit',
|
'Request body larger than maxBodyLength limit',
|
||||||
AxiosError.ERR_BAD_REQUEST,
|
AxiosError.ERR_BAD_REQUEST,
|
||||||
config
|
config
|
||||||
));
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -555,17 +575,27 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|||||||
data = stream.Readable.from(data, { objectMode: false });
|
data = stream.Readable.from(data, { objectMode: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
data = stream.pipeline([data, new AxiosTransformStream({
|
data = stream.pipeline(
|
||||||
maxRate: utils.toFiniteNumber(maxUploadRate)
|
[
|
||||||
})], utils.noop);
|
data,
|
||||||
|
new AxiosTransformStream({
|
||||||
|
maxRate: utils.toFiniteNumber(maxUploadRate),
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
utils.noop
|
||||||
|
);
|
||||||
|
|
||||||
onUploadProgress && data.on('progress', flushOnFinish(
|
onUploadProgress &&
|
||||||
|
data.on(
|
||||||
|
'progress',
|
||||||
|
flushOnFinish(
|
||||||
data,
|
data,
|
||||||
progressEventDecorator(
|
progressEventDecorator(
|
||||||
contentLength,
|
contentLength,
|
||||||
progressEventReducer(asyncDecorator(onUploadProgress), false, 3)
|
progressEventReducer(asyncDecorator(onUploadProgress), false, 3)
|
||||||
)
|
)
|
||||||
));
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// HTTP basic authentication
|
// HTTP basic authentication
|
||||||
@@ -602,7 +632,8 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|||||||
|
|
||||||
headers.set(
|
headers.set(
|
||||||
'Accept-Encoding',
|
'Accept-Encoding',
|
||||||
'gzip, compress, deflate' + (isBrotliSupported ? ', br' : ''), false
|
'gzip, compress, deflate' + (isBrotliSupported ? ', br' : ''),
|
||||||
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
@@ -615,7 +646,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|||||||
family,
|
family,
|
||||||
beforeRedirect: dispatchBeforeRedirect,
|
beforeRedirect: dispatchBeforeRedirect,
|
||||||
beforeRedirects: {},
|
beforeRedirects: {},
|
||||||
http2Options
|
http2Options,
|
||||||
};
|
};
|
||||||
|
|
||||||
// cacheable-lookup integration hotfix
|
// cacheable-lookup integration hotfix
|
||||||
@@ -624,9 +655,15 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|||||||
if (config.socketPath) {
|
if (config.socketPath) {
|
||||||
options.socketPath = config.socketPath;
|
options.socketPath = config.socketPath;
|
||||||
} else {
|
} else {
|
||||||
options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
|
options.hostname = parsed.hostname.startsWith('[')
|
||||||
|
? parsed.hostname.slice(1, -1)
|
||||||
|
: parsed.hostname;
|
||||||
options.port = parsed.port;
|
options.port = parsed.port;
|
||||||
setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
|
setProxy(
|
||||||
|
options,
|
||||||
|
config.proxy,
|
||||||
|
protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let transport;
|
let transport;
|
||||||
@@ -672,16 +709,20 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|||||||
|
|
||||||
if (onDownloadProgress || maxDownloadRate) {
|
if (onDownloadProgress || maxDownloadRate) {
|
||||||
const transformStream = new AxiosTransformStream({
|
const transformStream = new AxiosTransformStream({
|
||||||
maxRate: utils.toFiniteNumber(maxDownloadRate)
|
maxRate: utils.toFiniteNumber(maxDownloadRate),
|
||||||
});
|
});
|
||||||
|
|
||||||
onDownloadProgress && transformStream.on('progress', flushOnFinish(
|
onDownloadProgress &&
|
||||||
|
transformStream.on(
|
||||||
|
'progress',
|
||||||
|
flushOnFinish(
|
||||||
transformStream,
|
transformStream,
|
||||||
progressEventDecorator(
|
progressEventDecorator(
|
||||||
responseLength,
|
responseLength,
|
||||||
progressEventReducer(asyncDecorator(onDownloadProgress), true, 3)
|
progressEventReducer(asyncDecorator(onDownloadProgress), true, 3)
|
||||||
)
|
)
|
||||||
));
|
)
|
||||||
|
);
|
||||||
|
|
||||||
streams.push(transformStream);
|
streams.push(transformStream);
|
||||||
}
|
}
|
||||||
@@ -731,14 +772,12 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|||||||
|
|
||||||
responseStream = streams.length > 1 ? stream.pipeline(streams, utils.noop) : streams[0];
|
responseStream = streams.length > 1 ? stream.pipeline(streams, utils.noop) : streams[0];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const response = {
|
const response = {
|
||||||
status: res.statusCode,
|
status: res.statusCode,
|
||||||
statusText: res.statusMessage,
|
statusText: res.statusMessage,
|
||||||
headers: new AxiosHeaders(res.headers),
|
headers: new AxiosHeaders(res.headers),
|
||||||
config,
|
config,
|
||||||
request: lastRequest
|
request: lastRequest,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (responseType === 'stream') {
|
if (responseType === 'stream') {
|
||||||
@@ -757,8 +796,14 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|||||||
// stream.destroy() emit aborted event before calling reject() on Node.js v16
|
// stream.destroy() emit aborted event before calling reject() on Node.js v16
|
||||||
rejected = true;
|
rejected = true;
|
||||||
responseStream.destroy();
|
responseStream.destroy();
|
||||||
abort(new AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded',
|
abort(
|
||||||
AxiosError.ERR_BAD_RESPONSE, config, lastRequest));
|
new AxiosError(
|
||||||
|
'maxContentLength size of ' + config.maxContentLength + ' exceeded',
|
||||||
|
AxiosError.ERR_BAD_RESPONSE,
|
||||||
|
config,
|
||||||
|
lastRequest
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -784,7 +829,8 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|||||||
|
|
||||||
responseStream.on('end', function handleStreamEnd() {
|
responseStream.on('end', function handleStreamEnd() {
|
||||||
try {
|
try {
|
||||||
let responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer);
|
let responseData =
|
||||||
|
responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer);
|
||||||
if (responseType !== 'arraybuffer') {
|
if (responseType !== 'arraybuffer') {
|
||||||
responseData = responseData.toString(responseEncoding);
|
responseData = responseData.toString(responseEncoding);
|
||||||
if (!responseEncoding || responseEncoding === 'utf8') {
|
if (!responseEncoding || responseEncoding === 'utf8') {
|
||||||
@@ -799,7 +845,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
abortEmitter.once('abort', err => {
|
abortEmitter.once('abort', (err) => {
|
||||||
if (!responseStream.destroyed) {
|
if (!responseStream.destroyed) {
|
||||||
responseStream.emit('error', err);
|
responseStream.emit('error', err);
|
||||||
responseStream.destroy();
|
responseStream.destroy();
|
||||||
@@ -807,7 +853,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
abortEmitter.once('abort', err => {
|
abortEmitter.once('abort', (err) => {
|
||||||
if (req.close) {
|
if (req.close) {
|
||||||
req.close();
|
req.close();
|
||||||
} else {
|
} else {
|
||||||
@@ -832,12 +878,14 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|||||||
const timeout = parseInt(config.timeout, 10);
|
const timeout = parseInt(config.timeout, 10);
|
||||||
|
|
||||||
if (Number.isNaN(timeout)) {
|
if (Number.isNaN(timeout)) {
|
||||||
abort(new AxiosError(
|
abort(
|
||||||
|
new AxiosError(
|
||||||
'error trying to parse `config.timeout` to int',
|
'error trying to parse `config.timeout` to int',
|
||||||
AxiosError.ERR_BAD_OPTION_VALUE,
|
AxiosError.ERR_BAD_OPTION_VALUE,
|
||||||
config,
|
config,
|
||||||
req
|
req
|
||||||
));
|
)
|
||||||
|
);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -849,24 +897,27 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|||||||
// ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect.
|
// ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect.
|
||||||
req.setTimeout(timeout, function handleRequestTimeout() {
|
req.setTimeout(timeout, function handleRequestTimeout() {
|
||||||
if (isDone) return;
|
if (isDone) return;
|
||||||
let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
|
let timeoutErrorMessage = config.timeout
|
||||||
|
? 'timeout of ' + config.timeout + 'ms exceeded'
|
||||||
|
: 'timeout exceeded';
|
||||||
const transitional = config.transitional || transitionalDefaults;
|
const transitional = config.transitional || transitionalDefaults;
|
||||||
if (config.timeoutErrorMessage) {
|
if (config.timeoutErrorMessage) {
|
||||||
timeoutErrorMessage = config.timeoutErrorMessage;
|
timeoutErrorMessage = config.timeoutErrorMessage;
|
||||||
}
|
}
|
||||||
abort(new AxiosError(
|
abort(
|
||||||
|
new AxiosError(
|
||||||
timeoutErrorMessage,
|
timeoutErrorMessage,
|
||||||
transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
||||||
config,
|
config,
|
||||||
req
|
req
|
||||||
));
|
)
|
||||||
|
);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// explicitly reset the socket timeout value for a possible `keep-alive` request
|
// explicitly reset the socket timeout value for a possible `keep-alive` request
|
||||||
req.setTimeout(0);
|
req.setTimeout(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Send the request
|
// Send the request
|
||||||
if (utils.isStream(data)) {
|
if (utils.isStream(data)) {
|
||||||
let ended = false;
|
let ended = false;
|
||||||
@@ -876,7 +927,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|||||||
ended = true;
|
ended = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
data.once('error', err => {
|
data.once('error', (err) => {
|
||||||
errored = true;
|
errored = true;
|
||||||
req.destroy(err);
|
req.destroy(err);
|
||||||
});
|
});
|
||||||
@@ -893,6 +944,6 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|||||||
req.end();
|
req.end();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
export const __setProxy = setProxy;
|
export const __setProxy = setProxy;
|
||||||
|
|||||||
+41
-19
@@ -7,11 +7,12 @@ import parseProtocol from '../helpers/parseProtocol.js';
|
|||||||
import platform from '../platform/index.js';
|
import platform from '../platform/index.js';
|
||||||
import AxiosHeaders from '../core/AxiosHeaders.js';
|
import AxiosHeaders from '../core/AxiosHeaders.js';
|
||||||
import { progressEventReducer } from '../helpers/progressEventReducer.js';
|
import { progressEventReducer } from '../helpers/progressEventReducer.js';
|
||||||
import resolveConfig from "../helpers/resolveConfig.js";
|
import resolveConfig from '../helpers/resolveConfig.js';
|
||||||
|
|
||||||
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
||||||
|
|
||||||
export default isXHRAdapterSupported && function (config) {
|
export default isXHRAdapterSupported &&
|
||||||
|
function (config) {
|
||||||
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
||||||
const _config = resolveConfig(config);
|
const _config = resolveConfig(config);
|
||||||
let requestData = _config.data;
|
let requestData = _config.data;
|
||||||
@@ -45,24 +46,30 @@ export default isXHRAdapterSupported && function (config) {
|
|||||||
const responseHeaders = AxiosHeaders.from(
|
const responseHeaders = AxiosHeaders.from(
|
||||||
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
||||||
);
|
);
|
||||||
const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
const responseData =
|
||||||
request.responseText : request.response;
|
!responseType || responseType === 'text' || responseType === 'json'
|
||||||
|
? request.responseText
|
||||||
|
: request.response;
|
||||||
const response = {
|
const response = {
|
||||||
data: responseData,
|
data: responseData,
|
||||||
status: request.status,
|
status: request.status,
|
||||||
statusText: request.statusText,
|
statusText: request.statusText,
|
||||||
headers: responseHeaders,
|
headers: responseHeaders,
|
||||||
config,
|
config,
|
||||||
request
|
request,
|
||||||
};
|
};
|
||||||
|
|
||||||
settle(function _resolve(value) {
|
settle(
|
||||||
|
function _resolve(value) {
|
||||||
resolve(value);
|
resolve(value);
|
||||||
done();
|
done();
|
||||||
}, function _reject(err) {
|
},
|
||||||
|
function _reject(err) {
|
||||||
reject(err);
|
reject(err);
|
||||||
done();
|
done();
|
||||||
}, response);
|
},
|
||||||
|
response
|
||||||
|
);
|
||||||
|
|
||||||
// Clean up request
|
// Clean up request
|
||||||
request = null;
|
request = null;
|
||||||
@@ -82,7 +89,10 @@ export default isXHRAdapterSupported && function (config) {
|
|||||||
// handled by onerror instead
|
// handled by onerror instead
|
||||||
// With one exception: request that using file: protocol, most browsers
|
// With one exception: request that using file: protocol, most browsers
|
||||||
// will return status as 0 even though it's a successful request
|
// will return status as 0 even though it's a successful request
|
||||||
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
if (
|
||||||
|
request.status === 0 &&
|
||||||
|
!(request.responseURL && request.responseURL.indexOf('file:') === 0)
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// readystate handler is calling before onerror or ontimeout handlers,
|
// readystate handler is calling before onerror or ontimeout handlers,
|
||||||
@@ -118,16 +128,21 @@ export default isXHRAdapterSupported && function (config) {
|
|||||||
|
|
||||||
// Handle timeout
|
// Handle timeout
|
||||||
request.ontimeout = function handleTimeout() {
|
request.ontimeout = function handleTimeout() {
|
||||||
let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
|
let timeoutErrorMessage = _config.timeout
|
||||||
|
? 'timeout of ' + _config.timeout + 'ms exceeded'
|
||||||
|
: 'timeout exceeded';
|
||||||
const transitional = _config.transitional || transitionalDefaults;
|
const transitional = _config.transitional || transitionalDefaults;
|
||||||
if (_config.timeoutErrorMessage) {
|
if (_config.timeoutErrorMessage) {
|
||||||
timeoutErrorMessage = _config.timeoutErrorMessage;
|
timeoutErrorMessage = _config.timeoutErrorMessage;
|
||||||
}
|
}
|
||||||
reject(new AxiosError(
|
reject(
|
||||||
|
new AxiosError(
|
||||||
timeoutErrorMessage,
|
timeoutErrorMessage,
|
||||||
transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
||||||
config,
|
config,
|
||||||
request));
|
request
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
// Clean up request
|
// Clean up request
|
||||||
request = null;
|
request = null;
|
||||||
@@ -155,13 +170,13 @@ export default isXHRAdapterSupported && function (config) {
|
|||||||
|
|
||||||
// Handle progress if needed
|
// Handle progress if needed
|
||||||
if (onDownloadProgress) {
|
if (onDownloadProgress) {
|
||||||
([downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true));
|
[downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
|
||||||
request.addEventListener('progress', downloadThrottled);
|
request.addEventListener('progress', downloadThrottled);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not all browsers support upload events
|
// Not all browsers support upload events
|
||||||
if (onUploadProgress && request.upload) {
|
if (onUploadProgress && request.upload) {
|
||||||
([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
|
[uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
|
||||||
|
|
||||||
request.upload.addEventListener('progress', uploadThrottled);
|
request.upload.addEventListener('progress', uploadThrottled);
|
||||||
|
|
||||||
@@ -171,7 +186,7 @@ export default isXHRAdapterSupported && function (config) {
|
|||||||
if (_config.cancelToken || _config.signal) {
|
if (_config.cancelToken || _config.signal) {
|
||||||
// Handle cancellation
|
// Handle cancellation
|
||||||
// eslint-disable-next-line func-names
|
// eslint-disable-next-line func-names
|
||||||
onCanceled = cancel => {
|
onCanceled = (cancel) => {
|
||||||
if (!request) {
|
if (!request) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -182,19 +197,26 @@ export default isXHRAdapterSupported && function (config) {
|
|||||||
|
|
||||||
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
||||||
if (_config.signal) {
|
if (_config.signal) {
|
||||||
_config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
|
_config.signal.aborted
|
||||||
|
? onCanceled()
|
||||||
|
: _config.signal.addEventListener('abort', onCanceled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const protocol = parseProtocol(_config.url);
|
const protocol = parseProtocol(_config.url);
|
||||||
|
|
||||||
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
||||||
reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
|
reject(
|
||||||
|
new AxiosError(
|
||||||
|
'Unsupported protocol ' + protocol + ':',
|
||||||
|
AxiosError.ERR_BAD_REQUEST,
|
||||||
|
config
|
||||||
|
)
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Send the request
|
// Send the request
|
||||||
request.send(requestData || null);
|
request.send(requestData || null);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|||||||
+3
-3
@@ -14,7 +14,7 @@ import toFormData from './helpers/toFormData.js';
|
|||||||
import AxiosError from './core/AxiosError.js';
|
import AxiosError from './core/AxiosError.js';
|
||||||
import spread from './helpers/spread.js';
|
import spread from './helpers/spread.js';
|
||||||
import isAxiosError from './helpers/isAxiosError.js';
|
import isAxiosError from './helpers/isAxiosError.js';
|
||||||
import AxiosHeaders from "./core/AxiosHeaders.js";
|
import AxiosHeaders from './core/AxiosHeaders.js';
|
||||||
import adapters from './adapters/adapters.js';
|
import adapters from './adapters/adapters.js';
|
||||||
import HttpStatusCode from './helpers/HttpStatusCode.js';
|
import HttpStatusCode from './helpers/HttpStatusCode.js';
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ axios.mergeConfig = mergeConfig;
|
|||||||
|
|
||||||
axios.AxiosHeaders = AxiosHeaders;
|
axios.AxiosHeaders = AxiosHeaders;
|
||||||
|
|
||||||
axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
|
axios.formToJSON = (thing) => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
|
||||||
|
|
||||||
axios.getAdapter = adapters.getAdapter;
|
axios.getAdapter = adapters.getAdapter;
|
||||||
|
|
||||||
@@ -86,4 +86,4 @@ axios.HttpStatusCode = HttpStatusCode;
|
|||||||
axios.default = axios;
|
axios.default = axios;
|
||||||
|
|
||||||
// this module should only have a default export
|
// this module should only have a default export
|
||||||
export default axios
|
export default axios;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class CancelToken {
|
|||||||
const token = this;
|
const token = this;
|
||||||
|
|
||||||
// eslint-disable-next-line func-names
|
// eslint-disable-next-line func-names
|
||||||
this.promise.then(cancel => {
|
this.promise.then((cancel) => {
|
||||||
if (!token._listeners) return;
|
if (!token._listeners) return;
|
||||||
|
|
||||||
let i = token._listeners.length;
|
let i = token._listeners.length;
|
||||||
@@ -36,10 +36,10 @@ class CancelToken {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// eslint-disable-next-line func-names
|
// eslint-disable-next-line func-names
|
||||||
this.promise.then = onfulfilled => {
|
this.promise.then = (onfulfilled) => {
|
||||||
let _resolve;
|
let _resolve;
|
||||||
// eslint-disable-next-line func-names
|
// eslint-disable-next-line func-names
|
||||||
const promise = new Promise(resolve => {
|
const promise = new Promise((resolve) => {
|
||||||
token.subscribe(resolve);
|
token.subscribe(resolve);
|
||||||
_resolve = resolve;
|
_resolve = resolve;
|
||||||
}).then(onfulfilled);
|
}).then(onfulfilled);
|
||||||
@@ -127,7 +127,7 @@ class CancelToken {
|
|||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
token,
|
token,
|
||||||
cancel
|
cancel,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+46
-32
@@ -24,7 +24,7 @@ class Axios {
|
|||||||
this.defaults = instanceConfig || {};
|
this.defaults = instanceConfig || {};
|
||||||
this.interceptors = {
|
this.interceptors = {
|
||||||
request: new InterceptorManager(),
|
request: new InterceptorManager(),
|
||||||
response: new InterceptorManager()
|
response: new InterceptorManager(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ class Axios {
|
|||||||
err.stack = stack;
|
err.stack = stack;
|
||||||
// match without the 2 top stack lines
|
// match without the 2 top stack lines
|
||||||
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
|
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
|
||||||
err.stack += '\n' + stack
|
err.stack += '\n' + stack;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// ignore the case where "stack" is an un-writable property
|
// ignore the case where "stack" is an un-writable property
|
||||||
@@ -78,24 +78,32 @@ class Axios {
|
|||||||
const { transitional, paramsSerializer, headers } = config;
|
const { transitional, paramsSerializer, headers } = config;
|
||||||
|
|
||||||
if (transitional !== undefined) {
|
if (transitional !== undefined) {
|
||||||
validator.assertOptions(transitional, {
|
validator.assertOptions(
|
||||||
|
transitional,
|
||||||
|
{
|
||||||
silentJSONParsing: validators.transitional(validators.boolean),
|
silentJSONParsing: validators.transitional(validators.boolean),
|
||||||
forcedJSONParsing: validators.transitional(validators.boolean),
|
forcedJSONParsing: validators.transitional(validators.boolean),
|
||||||
clarifyTimeoutError: validators.transitional(validators.boolean),
|
clarifyTimeoutError: validators.transitional(validators.boolean),
|
||||||
legacyInterceptorReqResOrdering: validators.transitional(validators.boolean)
|
legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
|
||||||
}, false);
|
},
|
||||||
|
false
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (paramsSerializer != null) {
|
if (paramsSerializer != null) {
|
||||||
if (utils.isFunction(paramsSerializer)) {
|
if (utils.isFunction(paramsSerializer)) {
|
||||||
config.paramsSerializer = {
|
config.paramsSerializer = {
|
||||||
serialize: paramsSerializer
|
serialize: paramsSerializer,
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
validator.assertOptions(paramsSerializer, {
|
validator.assertOptions(
|
||||||
|
paramsSerializer,
|
||||||
|
{
|
||||||
encode: validators.function,
|
encode: validators.function,
|
||||||
serialize: validators.function
|
serialize: validators.function,
|
||||||
}, true);
|
},
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,26 +116,25 @@ class Axios {
|
|||||||
config.allowAbsoluteUrls = true;
|
config.allowAbsoluteUrls = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
validator.assertOptions(config, {
|
validator.assertOptions(
|
||||||
|
config,
|
||||||
|
{
|
||||||
baseUrl: validators.spelling('baseURL'),
|
baseUrl: validators.spelling('baseURL'),
|
||||||
withXsrfToken: validators.spelling('withXSRFToken')
|
withXsrfToken: validators.spelling('withXSRFToken'),
|
||||||
}, true);
|
},
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
// Set config.method
|
// Set config.method
|
||||||
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
||||||
|
|
||||||
// Flatten headers
|
// Flatten headers
|
||||||
let contextHeaders = headers && utils.merge(
|
let contextHeaders = headers && utils.merge(headers.common, headers[config.method]);
|
||||||
headers.common,
|
|
||||||
headers[config.method]
|
|
||||||
);
|
|
||||||
|
|
||||||
headers && utils.forEach(
|
headers &&
|
||||||
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], (method) => {
|
||||||
(method) => {
|
|
||||||
delete headers[method];
|
delete headers[method];
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
config.headers = AxiosHeaders.concat(contextHeaders, headers);
|
config.headers = AxiosHeaders.concat(contextHeaders, headers);
|
||||||
|
|
||||||
@@ -142,7 +149,8 @@ class Axios {
|
|||||||
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
||||||
|
|
||||||
const transitional = config.transitional || transitionalDefaults;
|
const transitional = config.transitional || transitionalDefaults;
|
||||||
const legacyInterceptorReqResOrdering = transitional && transitional.legacyInterceptorReqResOrdering;
|
const legacyInterceptorReqResOrdering =
|
||||||
|
transitional && transitional.legacyInterceptorReqResOrdering;
|
||||||
|
|
||||||
if (legacyInterceptorReqResOrdering) {
|
if (legacyInterceptorReqResOrdering) {
|
||||||
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
||||||
@@ -217,11 +225,13 @@ class Axios {
|
|||||||
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
||||||
/*eslint func-names:0*/
|
/*eslint func-names:0*/
|
||||||
Axios.prototype[method] = function (url, config) {
|
Axios.prototype[method] = function (url, config) {
|
||||||
return this.request(mergeConfig(config || {}, {
|
return this.request(
|
||||||
|
mergeConfig(config || {}, {
|
||||||
method,
|
method,
|
||||||
url,
|
url,
|
||||||
data: (config || {}).data
|
data: (config || {}).data,
|
||||||
}));
|
})
|
||||||
|
);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -230,14 +240,18 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|||||||
|
|
||||||
function generateHTTPMethod(isForm) {
|
function generateHTTPMethod(isForm) {
|
||||||
return function httpMethod(url, data, config) {
|
return function httpMethod(url, data, config) {
|
||||||
return this.request(mergeConfig(config || {}, {
|
return this.request(
|
||||||
|
mergeConfig(config || {}, {
|
||||||
method,
|
method,
|
||||||
headers: isForm ? {
|
headers: isForm
|
||||||
'Content-Type': 'multipart/form-data'
|
? {
|
||||||
} : {},
|
'Content-Type': 'multipart/form-data',
|
||||||
|
}
|
||||||
|
: {},
|
||||||
url,
|
url,
|
||||||
data
|
data,
|
||||||
}));
|
})
|
||||||
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+49
-19
@@ -52,8 +52,10 @@ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function formatHeader(header) {
|
function formatHeader(header) {
|
||||||
return header.trim()
|
return header
|
||||||
.toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
.trim()
|
||||||
|
.toLowerCase()
|
||||||
|
.replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
||||||
return char.toUpperCase() + str;
|
return char.toUpperCase() + str;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -61,12 +63,12 @@ function formatHeader(header) {
|
|||||||
function buildAccessors(obj, header) {
|
function buildAccessors(obj, header) {
|
||||||
const accessorName = utils.toCamelCase(' ' + header);
|
const accessorName = utils.toCamelCase(' ' + header);
|
||||||
|
|
||||||
['get', 'set', 'has'].forEach(methodName => {
|
['get', 'set', 'has'].forEach((methodName) => {
|
||||||
Object.defineProperty(obj, methodName + accessorName, {
|
Object.defineProperty(obj, methodName + accessorName, {
|
||||||
value: function (arg1, arg2, arg3) {
|
value: function (arg1, arg2, arg3) {
|
||||||
return this[methodName].call(this, header, arg1, arg2, arg3);
|
return this[methodName].call(this, header, arg1, arg2, arg3);
|
||||||
},
|
},
|
||||||
configurable: true
|
configurable: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -88,7 +90,12 @@ class AxiosHeaders {
|
|||||||
|
|
||||||
const key = utils.findKey(self, lHeader);
|
const key = utils.findKey(self, lHeader);
|
||||||
|
|
||||||
if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
|
if (
|
||||||
|
!key ||
|
||||||
|
self[key] === undefined ||
|
||||||
|
_rewrite === true ||
|
||||||
|
(_rewrite === undefined && self[key] !== false)
|
||||||
|
) {
|
||||||
self[key || _header] = normalizeValue(_value);
|
self[key || _header] = normalizeValue(_value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -97,21 +104,26 @@ class AxiosHeaders {
|
|||||||
utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
||||||
|
|
||||||
if (utils.isPlainObject(header) || header instanceof this.constructor) {
|
if (utils.isPlainObject(header) || header instanceof this.constructor) {
|
||||||
setHeaders(header, valueOrRewrite)
|
setHeaders(header, valueOrRewrite);
|
||||||
} else if (utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
} else if (utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
||||||
setHeaders(parseHeaders(header), valueOrRewrite);
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
||||||
} else if (utils.isObject(header) && utils.isIterable(header)) {
|
} else if (utils.isObject(header) && utils.isIterable(header)) {
|
||||||
let obj = {}, dest, key;
|
let obj = {},
|
||||||
|
dest,
|
||||||
|
key;
|
||||||
for (const entry of header) {
|
for (const entry of header) {
|
||||||
if (!utils.isArray(entry)) {
|
if (!utils.isArray(entry)) {
|
||||||
throw TypeError('Object iterator must return a key-value pair');
|
throw TypeError('Object iterator must return a key-value pair');
|
||||||
}
|
}
|
||||||
|
|
||||||
obj[key = entry[0]] = (dest = obj[key]) ?
|
obj[(key = entry[0])] = (dest = obj[key])
|
||||||
(utils.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]]) : entry[1];
|
? utils.isArray(dest)
|
||||||
|
? [...dest, entry[1]]
|
||||||
|
: [dest, entry[1]]
|
||||||
|
: entry[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
setHeaders(obj, valueOrRewrite)
|
setHeaders(obj, valueOrRewrite);
|
||||||
} else {
|
} else {
|
||||||
header != null && setHeader(valueOrRewrite, header, rewrite);
|
header != null && setHeader(valueOrRewrite, header, rewrite);
|
||||||
}
|
}
|
||||||
@@ -155,7 +167,11 @@ class AxiosHeaders {
|
|||||||
if (header) {
|
if (header) {
|
||||||
const key = utils.findKey(this, header);
|
const key = utils.findKey(this, header);
|
||||||
|
|
||||||
return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
return !!(
|
||||||
|
key &&
|
||||||
|
this[key] !== undefined &&
|
||||||
|
(!matcher || matchHeaderValue(this, this[key], key, matcher))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -239,7 +255,9 @@ class AxiosHeaders {
|
|||||||
const obj = Object.create(null);
|
const obj = Object.create(null);
|
||||||
|
|
||||||
utils.forEach(this, (value, header) => {
|
utils.forEach(this, (value, header) => {
|
||||||
value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
|
value != null &&
|
||||||
|
value !== false &&
|
||||||
|
(obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
|
||||||
});
|
});
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
@@ -250,11 +268,13 @@ class AxiosHeaders {
|
|||||||
}
|
}
|
||||||
|
|
||||||
toString() {
|
toString() {
|
||||||
return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
|
return Object.entries(this.toJSON())
|
||||||
|
.map(([header, value]) => header + ': ' + value)
|
||||||
|
.join('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
getSetCookie() {
|
getSetCookie() {
|
||||||
return this.get("set-cookie") || [];
|
return this.get('set-cookie') || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
get [Symbol.toStringTag]() {
|
get [Symbol.toStringTag]() {
|
||||||
@@ -274,8 +294,11 @@ class AxiosHeaders {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static accessor(header) {
|
static accessor(header) {
|
||||||
const internals = this[$internals] = (this[$internals] = {
|
const internals =
|
||||||
accessors: {}
|
(this[$internals] =
|
||||||
|
this[$internals] =
|
||||||
|
{
|
||||||
|
accessors: {},
|
||||||
});
|
});
|
||||||
|
|
||||||
const accessors = internals.accessors;
|
const accessors = internals.accessors;
|
||||||
@@ -296,7 +319,14 @@ class AxiosHeaders {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
|
AxiosHeaders.accessor([
|
||||||
|
'Content-Type',
|
||||||
|
'Content-Length',
|
||||||
|
'Accept',
|
||||||
|
'Accept-Encoding',
|
||||||
|
'User-Agent',
|
||||||
|
'Authorization',
|
||||||
|
]);
|
||||||
|
|
||||||
// reserved names hotfix
|
// reserved names hotfix
|
||||||
utils.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
|
utils.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
|
||||||
@@ -305,8 +335,8 @@ utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
|
|||||||
get: () => value,
|
get: () => value,
|
||||||
set(headerValue) {
|
set(headerValue) {
|
||||||
this[mapped] = headerValue;
|
this[mapped] = headerValue;
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
utils.freezeMethods(AxiosHeaders);
|
utils.freezeMethods(AxiosHeaders);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class InterceptorManager {
|
|||||||
fulfilled,
|
fulfilled,
|
||||||
rejected,
|
rejected,
|
||||||
synchronous: options ? options.synchronous : false,
|
synchronous: options ? options.synchronous : false,
|
||||||
runWhen: options ? options.runWhen : null
|
runWhen: options ? options.runWhen : null,
|
||||||
});
|
});
|
||||||
return this.handlers.length - 1;
|
return this.handlers.length - 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import isCancel from '../cancel/isCancel.js';
|
|||||||
import defaults from '../defaults/index.js';
|
import defaults from '../defaults/index.js';
|
||||||
import CanceledError from '../cancel/CanceledError.js';
|
import CanceledError from '../cancel/CanceledError.js';
|
||||||
import AxiosHeaders from '../core/AxiosHeaders.js';
|
import AxiosHeaders from '../core/AxiosHeaders.js';
|
||||||
import adapters from "../adapters/adapters.js";
|
import adapters from '../adapters/adapters.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Throws a `CanceledError` if cancellation has been requested.
|
* Throws a `CanceledError` if cancellation has been requested.
|
||||||
@@ -37,10 +37,7 @@ export default function dispatchRequest(config) {
|
|||||||
config.headers = AxiosHeaders.from(config.headers);
|
config.headers = AxiosHeaders.from(config.headers);
|
||||||
|
|
||||||
// Transform request data
|
// Transform request data
|
||||||
config.data = transformData.call(
|
config.data = transformData.call(config, config.transformRequest);
|
||||||
config,
|
|
||||||
config.transformRequest
|
|
||||||
);
|
|
||||||
|
|
||||||
if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
|
if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
|
||||||
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
||||||
@@ -48,20 +45,18 @@ export default function dispatchRequest(config) {
|
|||||||
|
|
||||||
const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
|
const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
|
||||||
|
|
||||||
return adapter(config).then(function onAdapterResolution(response) {
|
return adapter(config).then(
|
||||||
|
function onAdapterResolution(response) {
|
||||||
throwIfCancellationRequested(config);
|
throwIfCancellationRequested(config);
|
||||||
|
|
||||||
// Transform response data
|
// Transform response data
|
||||||
response.data = transformData.call(
|
response.data = transformData.call(config, config.transformResponse, response);
|
||||||
config,
|
|
||||||
config.transformResponse,
|
|
||||||
response
|
|
||||||
);
|
|
||||||
|
|
||||||
response.headers = AxiosHeaders.from(response.headers);
|
response.headers = AxiosHeaders.from(response.headers);
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}, function onAdapterRejection(reason) {
|
},
|
||||||
|
function onAdapterRejection(reason) {
|
||||||
if (!isCancel(reason)) {
|
if (!isCancel(reason)) {
|
||||||
throwIfCancellationRequested(config);
|
throwIfCancellationRequested(config);
|
||||||
|
|
||||||
@@ -77,5 +72,6 @@ export default function dispatchRequest(config) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Promise.reject(reason);
|
return Promise.reject(reason);
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-21
@@ -1,10 +1,9 @@
|
|||||||
"use strict";
|
'use strict';
|
||||||
|
|
||||||
import utils from "../utils.js";
|
import utils from '../utils.js';
|
||||||
import AxiosHeaders from "./AxiosHeaders.js";
|
import AxiosHeaders from './AxiosHeaders.js';
|
||||||
|
|
||||||
const headersToObject = (thing) =>
|
const headersToObject = (thing) => (thing instanceof AxiosHeaders ? { ...thing } : thing);
|
||||||
thing instanceof AxiosHeaders ? { ...thing } : thing;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Config-specific merge-function which creates a new config-object
|
* Config-specific merge-function which creates a new config-object
|
||||||
@@ -97,23 +96,12 @@ export default function mergeConfig(config1, config2) {
|
|||||||
mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),
|
mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),
|
||||||
};
|
};
|
||||||
|
|
||||||
utils.forEach(
|
utils.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
|
||||||
Object.keys({ ...config1, ...config2 }),
|
if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
|
||||||
function computeConfigValue(prop) {
|
const merge = utils.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
|
||||||
if (
|
|
||||||
prop === "__proto__" ||
|
|
||||||
prop === "constructor" ||
|
|
||||||
prop === "prototype"
|
|
||||||
)
|
|
||||||
return;
|
|
||||||
const merge = utils.hasOwnProp(mergeMap, prop)
|
|
||||||
? mergeMap[prop]
|
|
||||||
: mergeDeepProperties;
|
|
||||||
const configValue = merge(config1[prop], config2[prop], prop);
|
const configValue = merge(config1[prop], config2[prop], prop);
|
||||||
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) ||
|
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
||||||
(config[prop] = configValue);
|
});
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-3
@@ -16,12 +16,16 @@ export default function settle(resolve, reject, response) {
|
|||||||
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
||||||
resolve(response);
|
resolve(response);
|
||||||
} else {
|
} else {
|
||||||
reject(new AxiosError(
|
reject(
|
||||||
|
new AxiosError(
|
||||||
'Request failed with status code ' + response.status,
|
'Request failed with status code ' + response.status,
|
||||||
[AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
[AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][
|
||||||
|
Math.floor(response.status / 100) - 4
|
||||||
|
],
|
||||||
response.config,
|
response.config,
|
||||||
response.request,
|
response.request,
|
||||||
response
|
response
|
||||||
));
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+24
-13
@@ -34,12 +34,12 @@ function stringifySafely(rawValue, parser, encoder) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const defaults = {
|
const defaults = {
|
||||||
|
|
||||||
transitional: transitionalDefaults,
|
transitional: transitionalDefaults,
|
||||||
|
|
||||||
adapter: ['xhr', 'http', 'fetch'],
|
adapter: ['xhr', 'http', 'fetch'],
|
||||||
|
|
||||||
transformRequest: [function transformRequest(data, headers) {
|
transformRequest: [
|
||||||
|
function transformRequest(data, headers) {
|
||||||
const contentType = headers.getContentType() || '';
|
const contentType = headers.getContentType() || '';
|
||||||
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
||||||
const isObjectPayload = utils.isObject(data);
|
const isObjectPayload = utils.isObject(data);
|
||||||
@@ -54,7 +54,8 @@ const defaults = {
|
|||||||
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (utils.isArrayBuffer(data) ||
|
if (
|
||||||
|
utils.isArrayBuffer(data) ||
|
||||||
utils.isBuffer(data) ||
|
utils.isBuffer(data) ||
|
||||||
utils.isStream(data) ||
|
utils.isStream(data) ||
|
||||||
utils.isFile(data) ||
|
utils.isFile(data) ||
|
||||||
@@ -78,7 +79,10 @@ const defaults = {
|
|||||||
return toURLEncodedForm(data, this.formSerializer).toString();
|
return toURLEncodedForm(data, this.formSerializer).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
|
if (
|
||||||
|
(isFileList = utils.isFileList(data)) ||
|
||||||
|
contentType.indexOf('multipart/form-data') > -1
|
||||||
|
) {
|
||||||
const _FormData = this.env && this.env.FormData;
|
const _FormData = this.env && this.env.FormData;
|
||||||
|
|
||||||
return toFormData(
|
return toFormData(
|
||||||
@@ -95,9 +99,11 @@ const defaults = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}],
|
},
|
||||||
|
],
|
||||||
|
|
||||||
transformResponse: [function transformResponse(data) {
|
transformResponse: [
|
||||||
|
function transformResponse(data) {
|
||||||
const transitional = this.transitional || defaults.transitional;
|
const transitional = this.transitional || defaults.transitional;
|
||||||
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
||||||
const JSONRequested = this.responseType === 'json';
|
const JSONRequested = this.responseType === 'json';
|
||||||
@@ -106,7 +112,11 @@ const defaults = {
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
if (
|
||||||
|
data &&
|
||||||
|
utils.isString(data) &&
|
||||||
|
((forcedJSONParsing && !this.responseType) || JSONRequested)
|
||||||
|
) {
|
||||||
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
||||||
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
||||||
|
|
||||||
@@ -123,7 +133,8 @@ const defaults = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}],
|
},
|
||||||
|
],
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
||||||
@@ -139,7 +150,7 @@ const defaults = {
|
|||||||
|
|
||||||
env: {
|
env: {
|
||||||
FormData: platform.classes.FormData,
|
FormData: platform.classes.FormData,
|
||||||
Blob: platform.classes.Blob
|
Blob: platform.classes.Blob,
|
||||||
},
|
},
|
||||||
|
|
||||||
validateStatus: function validateStatus(status) {
|
validateStatus: function validateStatus(status) {
|
||||||
@@ -148,10 +159,10 @@ const defaults = {
|
|||||||
|
|
||||||
headers: {
|
headers: {
|
||||||
common: {
|
common: {
|
||||||
'Accept': 'application/json, text/plain, */*',
|
Accept: 'application/json, text/plain, */*',
|
||||||
'Content-Type': undefined
|
'Content-Type': undefined,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
||||||
|
|||||||
@@ -4,5 +4,5 @@ export default {
|
|||||||
silentJSONParsing: true,
|
silentJSONParsing: true,
|
||||||
forcedJSONParsing: true,
|
forcedJSONParsing: true,
|
||||||
clarifyTimeoutError: false,
|
clarifyTimeoutError: false,
|
||||||
legacyInterceptorReqResOrdering: true
|
legacyInterceptorReqResOrdering: true,
|
||||||
};
|
};
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
export const VERSION = "1.13.5";
|
export const VERSION = '1.13.5';
|
||||||
|
|||||||
@@ -7,22 +7,27 @@ const kInternals = Symbol('internals');
|
|||||||
|
|
||||||
class AxiosTransformStream extends stream.Transform {
|
class AxiosTransformStream extends stream.Transform {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
options = utils.toFlatObject(options, {
|
options = utils.toFlatObject(
|
||||||
|
options,
|
||||||
|
{
|
||||||
maxRate: 0,
|
maxRate: 0,
|
||||||
chunkSize: 64 * 1024,
|
chunkSize: 64 * 1024,
|
||||||
minChunkSize: 100,
|
minChunkSize: 100,
|
||||||
timeWindow: 500,
|
timeWindow: 500,
|
||||||
ticksRate: 2,
|
ticksRate: 2,
|
||||||
samplesCount: 15
|
samplesCount: 15,
|
||||||
}, null, (prop, source) => {
|
},
|
||||||
|
null,
|
||||||
|
(prop, source) => {
|
||||||
return !utils.isUndefined(source[prop]);
|
return !utils.isUndefined(source[prop]);
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
super({
|
super({
|
||||||
readableHighWaterMark: options.chunkSize
|
readableHighWaterMark: options.chunkSize,
|
||||||
});
|
});
|
||||||
|
|
||||||
const internals = this[kInternals] = {
|
const internals = (this[kInternals] = {
|
||||||
timeWindow: options.timeWindow,
|
timeWindow: options.timeWindow,
|
||||||
chunkSize: options.chunkSize,
|
chunkSize: options.chunkSize,
|
||||||
maxRate: options.maxRate,
|
maxRate: options.maxRate,
|
||||||
@@ -32,10 +37,10 @@ class AxiosTransformStream extends stream.Transform{
|
|||||||
notifiedBytesLoaded: 0,
|
notifiedBytesLoaded: 0,
|
||||||
ts: Date.now(),
|
ts: Date.now(),
|
||||||
bytes: 0,
|
bytes: 0,
|
||||||
onReadCallback: null
|
onReadCallback: null,
|
||||||
};
|
});
|
||||||
|
|
||||||
this.on('newListener', event => {
|
this.on('newListener', (event) => {
|
||||||
if (event === 'progress') {
|
if (event === 'progress') {
|
||||||
if (!internals.isCaptured) {
|
if (!internals.isCaptured) {
|
||||||
internals.isCaptured = true;
|
internals.isCaptured = true;
|
||||||
@@ -63,8 +68,11 @@ class AxiosTransformStream extends stream.Transform{
|
|||||||
const timeWindow = internals.timeWindow;
|
const timeWindow = internals.timeWindow;
|
||||||
|
|
||||||
const divider = 1000 / timeWindow;
|
const divider = 1000 / timeWindow;
|
||||||
const bytesThreshold = (maxRate / divider);
|
const bytesThreshold = maxRate / divider;
|
||||||
const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
|
const minChunkSize =
|
||||||
|
internals.minChunkSize !== false
|
||||||
|
? Math.max(internals.minChunkSize, bytesThreshold * 0.01)
|
||||||
|
: 0;
|
||||||
|
|
||||||
const pushChunk = (_chunk, _callback) => {
|
const pushChunk = (_chunk, _callback) => {
|
||||||
const bytes = Buffer.byteLength(_chunk);
|
const bytes = Buffer.byteLength(_chunk);
|
||||||
@@ -81,7 +89,7 @@ class AxiosTransformStream extends stream.Transform{
|
|||||||
process.nextTick(_callback);
|
process.nextTick(_callback);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
const transformChunk = (_chunk, _callback) => {
|
const transformChunk = (_chunk, _callback) => {
|
||||||
const chunkSize = Buffer.byteLength(_chunk);
|
const chunkSize = Buffer.byteLength(_chunk);
|
||||||
@@ -93,7 +101,7 @@ class AxiosTransformStream extends stream.Transform{
|
|||||||
if (maxRate) {
|
if (maxRate) {
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
|
|
||||||
if (!internals.ts || (passed = (now - internals.ts)) >= timeWindow) {
|
if (!internals.ts || (passed = now - internals.ts) >= timeWindow) {
|
||||||
internals.ts = now;
|
internals.ts = now;
|
||||||
bytesLeft = bytesThreshold - internals.bytes;
|
bytesLeft = bytesThreshold - internals.bytes;
|
||||||
internals.bytes = bytesLeft < 0 ? -bytesLeft : 0;
|
internals.bytes = bytesLeft < 0 ? -bytesLeft : 0;
|
||||||
@@ -116,14 +124,19 @@ class AxiosTransformStream extends stream.Transform{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maxChunkSize && chunkSize > maxChunkSize && (chunkSize - maxChunkSize) > minChunkSize) {
|
if (maxChunkSize && chunkSize > maxChunkSize && chunkSize - maxChunkSize > minChunkSize) {
|
||||||
chunkRemainder = _chunk.subarray(maxChunkSize);
|
chunkRemainder = _chunk.subarray(maxChunkSize);
|
||||||
_chunk = _chunk.subarray(0, maxChunkSize);
|
_chunk = _chunk.subarray(0, maxChunkSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
pushChunk(_chunk, chunkRemainder ? () => {
|
pushChunk(
|
||||||
|
_chunk,
|
||||||
|
chunkRemainder
|
||||||
|
? () => {
|
||||||
process.nextTick(_callback, null, chunkRemainder);
|
process.nextTick(_callback, null, chunkRemainder);
|
||||||
} : _callback);
|
}
|
||||||
|
: _callback
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
transformChunk(chunk, function transformNextChunk(err, _chunk) {
|
transformChunk(chunk, function transformNextChunk(err, _chunk) {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ function encode(str) {
|
|||||||
')': '%29',
|
')': '%29',
|
||||||
'~': '%7E',
|
'~': '%7E',
|
||||||
'%20': '+',
|
'%20': '+',
|
||||||
'%00': '\x00'
|
'%00': '\x00',
|
||||||
};
|
};
|
||||||
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
||||||
return charMap[match];
|
return charMap[match];
|
||||||
@@ -46,13 +46,17 @@ prototype.append = function append(name, value) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
prototype.toString = function toString(encoder) {
|
prototype.toString = function toString(encoder) {
|
||||||
const _encode = encoder ? function(value) {
|
const _encode = encoder
|
||||||
|
? function (value) {
|
||||||
return encoder.call(this, value, encode);
|
return encoder.call(this, value, encode);
|
||||||
} : encode;
|
}
|
||||||
|
: encode;
|
||||||
|
|
||||||
return this._pairs.map(function each(pair) {
|
return this._pairs
|
||||||
|
.map(function each(pair) {
|
||||||
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
||||||
}, '').join('&');
|
}, '')
|
||||||
|
.join('&');
|
||||||
};
|
};
|
||||||
|
|
||||||
export default AxiosURLSearchParams;
|
export default AxiosURLSearchParams;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"use strict";
|
'use strict';
|
||||||
|
|
||||||
import stream from "stream";
|
import stream from 'stream';
|
||||||
|
|
||||||
class ZlibHeaderTransformStream extends stream.Transform {
|
class ZlibHeaderTransformStream extends stream.Transform {
|
||||||
__transform(chunk, encoding, callback) {
|
__transform(chunk, encoding, callback) {
|
||||||
@@ -13,7 +13,8 @@ class ZlibHeaderTransformStream extends stream.Transform {
|
|||||||
this._transform = this.__transform;
|
this._transform = this.__transform;
|
||||||
|
|
||||||
// Add Default Compression headers if no zlib headers are present
|
// Add Default Compression headers if no zlib headers are present
|
||||||
if (chunk[0] !== 120) { // Hex: 78
|
if (chunk[0] !== 120) {
|
||||||
|
// Hex: 78
|
||||||
const header = Buffer.alloc(2);
|
const header = Buffer.alloc(2);
|
||||||
header[0] = 120; // Hex: 78
|
header[0] = 120; // Hex: 78
|
||||||
header[1] = 156; // Hex: 9C
|
header[1] = 156; // Hex: 9C
|
||||||
|
|||||||
+15
-13
@@ -12,11 +12,11 @@ import AxiosURLSearchParams from '../helpers/AxiosURLSearchParams.js';
|
|||||||
* @returns {string} The encoded value.
|
* @returns {string} The encoded value.
|
||||||
*/
|
*/
|
||||||
function encode(val) {
|
function encode(val) {
|
||||||
return encodeURIComponent(val).
|
return encodeURIComponent(val)
|
||||||
replace(/%3A/gi, ':').
|
.replace(/%3A/gi, ':')
|
||||||
replace(/%24/g, '$').
|
.replace(/%24/g, '$')
|
||||||
replace(/%2C/gi, ',').
|
.replace(/%2C/gi, ',')
|
||||||
replace(/%20/g, '+');
|
.replace(/%20/g, '+');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,11 +33,13 @@ export default function buildURL(url, params, options) {
|
|||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
const _encode = options && options.encode || encode;
|
const _encode = (options && options.encode) || encode;
|
||||||
|
|
||||||
const _options = utils.isFunction(options) ? {
|
const _options = utils.isFunction(options)
|
||||||
serialize: options
|
? {
|
||||||
} : options;
|
serialize: options,
|
||||||
|
}
|
||||||
|
: options;
|
||||||
|
|
||||||
const serializeFn = _options && _options.serialize;
|
const serializeFn = _options && _options.serialize;
|
||||||
|
|
||||||
@@ -46,13 +48,13 @@ export default function buildURL(url, params, options) {
|
|||||||
if (serializeFn) {
|
if (serializeFn) {
|
||||||
serializedParams = serializeFn(params, _options);
|
serializedParams = serializeFn(params, _options);
|
||||||
} else {
|
} else {
|
||||||
serializedParams = utils.isURLSearchParams(params) ?
|
serializedParams = utils.isURLSearchParams(params)
|
||||||
params.toString() :
|
? params.toString()
|
||||||
new AxiosURLSearchParams(params, _options).toString(_encode);
|
: new AxiosURLSearchParams(params, _options).toString(_encode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (serializedParams) {
|
if (serializedParams) {
|
||||||
const hashmarkIndex = url.indexOf("#");
|
const hashmarkIndex = url.indexOf('#');
|
||||||
|
|
||||||
if (hashmarkIndex !== -1) {
|
if (hashmarkIndex !== -1) {
|
||||||
url = url.slice(0, hashmarkIndex);
|
url = url.slice(0, hashmarkIndex);
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import utils from "../utils.js";
|
import utils from '../utils.js';
|
||||||
|
|
||||||
const callbackify = (fn, reducer) => {
|
const callbackify = (fn, reducer) => {
|
||||||
return utils.isAsyncFn(fn) ? function (...args) {
|
return utils.isAsyncFn(fn)
|
||||||
|
? function (...args) {
|
||||||
const cb = args.pop();
|
const cb = args.pop();
|
||||||
fn.apply(this, args).then((value) => {
|
fn.apply(this, args).then((value) => {
|
||||||
try {
|
try {
|
||||||
@@ -10,7 +11,8 @@ const callbackify = (fn, reducer) => {
|
|||||||
cb(err);
|
cb(err);
|
||||||
}
|
}
|
||||||
}, cb);
|
}, cb);
|
||||||
} : fn;
|
|
||||||
}
|
}
|
||||||
|
: fn;
|
||||||
|
};
|
||||||
|
|
||||||
export default callbackify;
|
export default callbackify;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import CanceledError from "../cancel/CanceledError.js";
|
import CanceledError from '../cancel/CanceledError.js';
|
||||||
import AxiosError from "../core/AxiosError.js";
|
import AxiosError from '../core/AxiosError.js';
|
||||||
import utils from '../utils.js';
|
import utils from '../utils.js';
|
||||||
|
|
||||||
const composeSignals = (signals, timeout) => {
|
const composeSignals = (signals, timeout) => {
|
||||||
@@ -15,25 +15,33 @@ const composeSignals = (signals, timeout) => {
|
|||||||
aborted = true;
|
aborted = true;
|
||||||
unsubscribe();
|
unsubscribe();
|
||||||
const err = reason instanceof Error ? reason : this.reason;
|
const err = reason instanceof Error ? reason : this.reason;
|
||||||
controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
|
controller.abort(
|
||||||
}
|
err instanceof AxiosError
|
||||||
|
? err
|
||||||
|
: new CanceledError(err instanceof Error ? err.message : err)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
let timer = timeout && setTimeout(() => {
|
let timer =
|
||||||
|
timeout &&
|
||||||
|
setTimeout(() => {
|
||||||
timer = null;
|
timer = null;
|
||||||
onabort(new AxiosError(`timeout of ${timeout}ms exceeded`, AxiosError.ETIMEDOUT))
|
onabort(new AxiosError(`timeout of ${timeout}ms exceeded`, AxiosError.ETIMEDOUT));
|
||||||
}, timeout)
|
}, timeout);
|
||||||
|
|
||||||
const unsubscribe = () => {
|
const unsubscribe = () => {
|
||||||
if (signals) {
|
if (signals) {
|
||||||
timer && clearTimeout(timer);
|
timer && clearTimeout(timer);
|
||||||
timer = null;
|
timer = null;
|
||||||
signals.forEach(signal => {
|
signals.forEach((signal) => {
|
||||||
signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
|
signal.unsubscribe
|
||||||
|
? signal.unsubscribe(onabort)
|
||||||
|
: signal.removeEventListener('abort', onabort);
|
||||||
});
|
});
|
||||||
signals = null;
|
signals = null;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
signals.forEach((signal) => signal.addEventListener('abort', onabort));
|
signals.forEach((signal) => signal.addEventListener('abort', onabort));
|
||||||
|
|
||||||
@@ -43,6 +51,6 @@ const composeSignals = (signals, timeout) => {
|
|||||||
|
|
||||||
return signal;
|
return signal;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export default composeSignals;
|
export default composeSignals;
|
||||||
|
|||||||
+5
-10
@@ -1,9 +1,8 @@
|
|||||||
import utils from '../utils.js';
|
import utils from '../utils.js';
|
||||||
import platform from '../platform/index.js';
|
import platform from '../platform/index.js';
|
||||||
|
|
||||||
export default platform.hasStandardBrowserEnv ?
|
export default platform.hasStandardBrowserEnv
|
||||||
|
? // Standard browser envs support document.cookie
|
||||||
// Standard browser envs support document.cookie
|
|
||||||
{
|
{
|
||||||
write(name, value, expires, path, domain, secure, sameSite) {
|
write(name, value, expires, path, domain, secure, sameSite) {
|
||||||
if (typeof document === 'undefined') return;
|
if (typeof document === 'undefined') return;
|
||||||
@@ -37,17 +36,13 @@ export default platform.hasStandardBrowserEnv ?
|
|||||||
|
|
||||||
remove(name) {
|
remove(name) {
|
||||||
this.write(name, '', Date.now() - 86400000, '/');
|
this.write(name, '', Date.now() - 86400000, '/');
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
: // Non-standard browser env (web workers, react-native) lack needed support.
|
||||||
|
|
||||||
:
|
|
||||||
|
|
||||||
// Non-standard browser env (web workers, react-native) lack needed support.
|
|
||||||
{
|
{
|
||||||
write() {},
|
write() {},
|
||||||
read() {
|
read() {
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
remove() {}
|
remove() {},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -15,12 +15,17 @@
|
|||||||
export default function deprecatedMethod(method, instead, docs) {
|
export default function deprecatedMethod(method, instead, docs) {
|
||||||
try {
|
try {
|
||||||
console.warn(
|
console.warn(
|
||||||
'DEPRECATED method `' + method + '`.' +
|
'DEPRECATED method `' +
|
||||||
|
method +
|
||||||
|
'`.' +
|
||||||
(instead ? ' Use `' + instead + '` instead.' : '') +
|
(instead ? ' Use `' + instead + '` instead.' : '') +
|
||||||
' This method will be removed in a future release.');
|
' This method will be removed in a future release.'
|
||||||
|
);
|
||||||
|
|
||||||
if (docs) {
|
if (docs) {
|
||||||
console.warn('For more information about usage see ' + docs);
|
console.warn('For more information about usage see ' + docs);
|
||||||
}
|
}
|
||||||
} catch (e) { /* Ignore */ }
|
} catch (e) {
|
||||||
|
/* Ignore */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ function parsePropPath(name) {
|
|||||||
// foo.x.y.z
|
// foo.x.y.z
|
||||||
// foo-x-y-z
|
// foo-x-y-z
|
||||||
// foo x y z
|
// foo x y z
|
||||||
return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
|
return utils.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
|
||||||
return match[0] === '[]' ? '' : match[1] || match[0];
|
return match[0] === '[]' ? '' : match[1] || match[0];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import util from 'util';
|
import util from 'util';
|
||||||
import { Readable } from 'stream';
|
import { Readable } from 'stream';
|
||||||
import utils from "../utils.js";
|
import utils from '../utils.js';
|
||||||
import readBlob from "./readBlob.js";
|
import readBlob from './readBlob.js';
|
||||||
import platform from "../platform/index.js";
|
import platform from '../platform/index.js';
|
||||||
|
|
||||||
const BOUNDARY_ALPHABET = platform.ALPHABET.ALPHA_DIGIT + '-_';
|
const BOUNDARY_ALPHABET = platform.ALPHABET.ALPHA_DIGIT + '-_';
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ class FormDataPart {
|
|||||||
if (isStringValue) {
|
if (isStringValue) {
|
||||||
value = textEncoder.encode(String(value).replace(/\r?\n|\r\n?/g, CRLF));
|
value = textEncoder.encode(String(value).replace(/\r?\n|\r\n?/g, CRLF));
|
||||||
} else {
|
} else {
|
||||||
headers += `Content-Type: ${value.type || "application/octet-stream"}${CRLF}`
|
headers += `Content-Type: ${value.type || 'application/octet-stream'}${CRLF}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.headers = textEncoder.encode(headers + CRLF);
|
this.headers = textEncoder.encode(headers + CRLF);
|
||||||
@@ -52,11 +52,15 @@ class FormDataPart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static escapeName(name) {
|
static escapeName(name) {
|
||||||
return String(name).replace(/[\r\n"]/g, (match) => ({
|
return String(name).replace(
|
||||||
|
/[\r\n"]/g,
|
||||||
|
(match) =>
|
||||||
|
({
|
||||||
'\r': '%0D',
|
'\r': '%0D',
|
||||||
'\n': '%0A',
|
'\n': '%0A',
|
||||||
'"': '%22',
|
'"': '%22',
|
||||||
}[match]));
|
})[match]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +68,7 @@ const formDataToStream = (form, headersHandler, options) => {
|
|||||||
const {
|
const {
|
||||||
tag = 'form-data-boundary',
|
tag = 'form-data-boundary',
|
||||||
size = 25,
|
size = 25,
|
||||||
boundary = tag + '-' + platform.generateString(size, BOUNDARY_ALPHABET)
|
boundary = tag + '-' + platform.generateString(size, BOUNDARY_ALPHABET),
|
||||||
} = options || {};
|
} = options || {};
|
||||||
|
|
||||||
if (!utils.isFormData(form)) {
|
if (!utils.isFormData(form)) {
|
||||||
@@ -72,7 +76,7 @@ const formDataToStream = (form, headersHandler, options) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (boundary.length < 1 || boundary.length > 70) {
|
if (boundary.length < 1 || boundary.length > 70) {
|
||||||
throw Error('boundary must be 10-70 characters long')
|
throw Error('boundary must be 10-70 characters long');
|
||||||
}
|
}
|
||||||
|
|
||||||
const boundaryBytes = textEncoder.encode('--' + boundary + CRLF);
|
const boundaryBytes = textEncoder.encode('--' + boundary + CRLF);
|
||||||
@@ -90,8 +94,8 @@ const formDataToStream = (form, headersHandler, options) => {
|
|||||||
contentLength = utils.toFiniteNumber(contentLength);
|
contentLength = utils.toFiniteNumber(contentLength);
|
||||||
|
|
||||||
const computedHeaders = {
|
const computedHeaders = {
|
||||||
'Content-Type': `multipart/form-data; boundary=${boundary}`
|
'Content-Type': `multipart/form-data; boundary=${boundary}`,
|
||||||
}
|
};
|
||||||
|
|
||||||
if (Number.isFinite(contentLength)) {
|
if (Number.isFinite(contentLength)) {
|
||||||
computedHeaders['Content-Length'] = contentLength;
|
computedHeaders['Content-Length'] = contentLength;
|
||||||
@@ -99,14 +103,16 @@ const formDataToStream = (form, headersHandler, options) => {
|
|||||||
|
|
||||||
headersHandler && headersHandler(computedHeaders);
|
headersHandler && headersHandler(computedHeaders);
|
||||||
|
|
||||||
return Readable.from((async function *() {
|
return Readable.from(
|
||||||
|
(async function* () {
|
||||||
for (const part of parts) {
|
for (const part of parts) {
|
||||||
yield boundaryBytes;
|
yield boundaryBytes;
|
||||||
yield* part.encode();
|
yield* part.encode();
|
||||||
}
|
}
|
||||||
|
|
||||||
yield footerBytes;
|
yield footerBytes;
|
||||||
})());
|
})()
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default formDataToStream;
|
export default formDataToStream;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const DATA_URL_PATTERN = /^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;
|
|||||||
* @returns {Buffer|Blob}
|
* @returns {Buffer|Blob}
|
||||||
*/
|
*/
|
||||||
export default function fromDataURI(uri, asBlob, options) {
|
export default function fromDataURI(uri, asBlob, options) {
|
||||||
const _Blob = options && options.Blob || platform.classes.Blob;
|
const _Blob = (options && options.Blob) || platform.classes.Blob;
|
||||||
const protocol = parseProtocol(uri);
|
const protocol = parseProtocol(uri);
|
||||||
|
|
||||||
if (asBlob === undefined && _Blob) {
|
if (asBlob === undefined && _Blob) {
|
||||||
|
|||||||
@@ -17,4 +17,3 @@ export default function isAbsoluteURL(url) {
|
|||||||
|
|
||||||
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,5 +10,5 @@ import utils from '../utils.js';
|
|||||||
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
||||||
*/
|
*/
|
||||||
export default function isAxiosError(payload) {
|
export default function isAxiosError(payload) {
|
||||||
return utils.isObject(payload) && (payload.isAxiosError === true);
|
return utils.isObject(payload) && payload.isAxiosError === true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import platform from '../platform/index.js';
|
import platform from '../platform/index.js';
|
||||||
|
|
||||||
export default platform.hasStandardBrowserEnv ? ((origin, isMSIE) => (url) => {
|
export default platform.hasStandardBrowserEnv
|
||||||
|
? ((origin, isMSIE) => (url) => {
|
||||||
url = new URL(url, platform.origin);
|
url = new URL(url, platform.origin);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -11,4 +12,5 @@ export default platform.hasStandardBrowserEnv ? ((origin, isMSIE) => (url) => {
|
|||||||
})(
|
})(
|
||||||
new URL(platform.origin),
|
new URL(platform.origin),
|
||||||
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
||||||
) : () => true;
|
)
|
||||||
|
: () => true;
|
||||||
|
|||||||
@@ -5,10 +5,23 @@ import utils from '../utils.js';
|
|||||||
// RawAxiosHeaders whose duplicates are ignored by node
|
// RawAxiosHeaders whose duplicates are ignored by node
|
||||||
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
||||||
const ignoreDuplicateOf = utils.toObjectSet([
|
const ignoreDuplicateOf = utils.toObjectSet([
|
||||||
'age', 'authorization', 'content-length', 'content-type', 'etag',
|
'age',
|
||||||
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
|
'authorization',
|
||||||
'last-modified', 'location', 'max-forwards', 'proxy-authorization',
|
'content-length',
|
||||||
'referer', 'retry-after', 'user-agent'
|
'content-type',
|
||||||
|
'etag',
|
||||||
|
'expires',
|
||||||
|
'from',
|
||||||
|
'host',
|
||||||
|
'if-modified-since',
|
||||||
|
'if-unmodified-since',
|
||||||
|
'last-modified',
|
||||||
|
'location',
|
||||||
|
'max-forwards',
|
||||||
|
'proxy-authorization',
|
||||||
|
'referer',
|
||||||
|
'retry-after',
|
||||||
|
'user-agent',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,13 +38,14 @@ const ignoreDuplicateOf = utils.toObjectSet([
|
|||||||
*
|
*
|
||||||
* @returns {Object} Headers parsed into an object
|
* @returns {Object} Headers parsed into an object
|
||||||
*/
|
*/
|
||||||
export default rawHeaders => {
|
export default (rawHeaders) => {
|
||||||
const parsed = {};
|
const parsed = {};
|
||||||
let key;
|
let key;
|
||||||
let val;
|
let val;
|
||||||
let i;
|
let i;
|
||||||
|
|
||||||
rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
|
rawHeaders &&
|
||||||
|
rawHeaders.split('\n').forEach(function parser(line) {
|
||||||
i = line.indexOf(':');
|
i = line.indexOf(':');
|
||||||
key = line.substring(0, i).trim().toLowerCase();
|
key = line.substring(0, i).trim().toLowerCase();
|
||||||
val = line.substring(i + 1).trim();
|
val = line.substring(i + 1).trim();
|
||||||
|
|||||||
@@ -2,5 +2,5 @@
|
|||||||
|
|
||||||
export default function parseProtocol(url) {
|
export default function parseProtocol(url) {
|
||||||
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
||||||
return match && match[1] || '';
|
return (match && match[1]) || '';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import speedometer from "./speedometer.js";
|
import speedometer from './speedometer.js';
|
||||||
import throttle from "./throttle.js";
|
import throttle from './throttle.js';
|
||||||
import utils from "../utils.js";
|
import utils from '../utils.js';
|
||||||
|
|
||||||
export const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
export const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
||||||
let bytesNotified = 0;
|
let bytesNotified = 0;
|
||||||
const _speedometer = speedometer(50, 250);
|
const _speedometer = speedometer(50, 250);
|
||||||
|
|
||||||
return throttle(e => {
|
return throttle((e) => {
|
||||||
const loaded = e.loaded;
|
const loaded = e.loaded;
|
||||||
const total = e.lengthComputable ? e.total : undefined;
|
const total = e.lengthComputable ? e.total : undefined;
|
||||||
const progressBytes = loaded - bytesNotified;
|
const progressBytes = loaded - bytesNotified;
|
||||||
@@ -18,27 +18,34 @@ export const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|||||||
const data = {
|
const data = {
|
||||||
loaded,
|
loaded,
|
||||||
total,
|
total,
|
||||||
progress: total ? (loaded / total) : undefined,
|
progress: total ? loaded / total : undefined,
|
||||||
bytes: progressBytes,
|
bytes: progressBytes,
|
||||||
rate: rate ? rate : undefined,
|
rate: rate ? rate : undefined,
|
||||||
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
||||||
event: e,
|
event: e,
|
||||||
lengthComputable: total != null,
|
lengthComputable: total != null,
|
||||||
[isDownloadStream ? 'download' : 'upload']: true
|
[isDownloadStream ? 'download' : 'upload']: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
listener(data);
|
listener(data);
|
||||||
}, freq);
|
}, freq);
|
||||||
}
|
};
|
||||||
|
|
||||||
export const progressEventDecorator = (total, throttled) => {
|
export const progressEventDecorator = (total, throttled) => {
|
||||||
const lengthComputable = total != null;
|
const lengthComputable = total != null;
|
||||||
|
|
||||||
return [(loaded) => throttled[0]({
|
return [
|
||||||
|
(loaded) =>
|
||||||
|
throttled[0]({
|
||||||
lengthComputable,
|
lengthComputable,
|
||||||
total,
|
total,
|
||||||
loaded
|
loaded,
|
||||||
}), throttled[1]];
|
}),
|
||||||
}
|
throttled[1],
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
export const asyncDecorator = (fn) => (...args) => utils.asap(() => fn(...args));
|
export const asyncDecorator =
|
||||||
|
(fn) =>
|
||||||
|
(...args) =>
|
||||||
|
utils.asap(() => fn(...args));
|
||||||
|
|||||||
@@ -2,14 +2,14 @@ const {asyncIterator} = Symbol;
|
|||||||
|
|
||||||
const readBlob = async function* (blob) {
|
const readBlob = async function* (blob) {
|
||||||
if (blob.stream) {
|
if (blob.stream) {
|
||||||
yield* blob.stream()
|
yield* blob.stream();
|
||||||
} else if (blob.arrayBuffer) {
|
} else if (blob.arrayBuffer) {
|
||||||
yield await blob.arrayBuffer()
|
yield await blob.arrayBuffer();
|
||||||
} else if (blob[asyncIterator]) {
|
} else if (blob[asyncIterator]) {
|
||||||
yield* blob[asyncIterator]();
|
yield* blob[asyncIterator]();
|
||||||
} else {
|
} else {
|
||||||
yield blob;
|
yield blob;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export default readBlob;
|
export default readBlob;
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import platform from "../platform/index.js";
|
import platform from '../platform/index.js';
|
||||||
import utils from "../utils.js";
|
import utils from '../utils.js';
|
||||||
import isURLSameOrigin from "./isURLSameOrigin.js";
|
import isURLSameOrigin from './isURLSameOrigin.js';
|
||||||
import cookies from "./cookies.js";
|
import cookies from './cookies.js';
|
||||||
import buildFullPath from "../core/buildFullPath.js";
|
import buildFullPath from '../core/buildFullPath.js';
|
||||||
import mergeConfig from "../core/mergeConfig.js";
|
import mergeConfig from '../core/mergeConfig.js';
|
||||||
import AxiosHeaders from "../core/AxiosHeaders.js";
|
import AxiosHeaders from '../core/AxiosHeaders.js';
|
||||||
import buildURL from "./buildURL.js";
|
import buildURL from './buildURL.js';
|
||||||
|
|
||||||
export default (config) => {
|
export default (config) => {
|
||||||
const newConfig = mergeConfig({}, config);
|
const newConfig = mergeConfig({}, config);
|
||||||
@@ -14,12 +14,22 @@ export default (config) => {
|
|||||||
|
|
||||||
newConfig.headers = headers = AxiosHeaders.from(headers);
|
newConfig.headers = headers = AxiosHeaders.from(headers);
|
||||||
|
|
||||||
newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
|
newConfig.url = buildURL(
|
||||||
|
buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls),
|
||||||
|
config.params,
|
||||||
|
config.paramsSerializer
|
||||||
|
);
|
||||||
|
|
||||||
// HTTP basic authentication
|
// HTTP basic authentication
|
||||||
if (auth) {
|
if (auth) {
|
||||||
headers.set('Authorization', 'Basic ' +
|
headers.set(
|
||||||
btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))
|
'Authorization',
|
||||||
|
'Basic ' +
|
||||||
|
btoa(
|
||||||
|
(auth.username || '') +
|
||||||
|
':' +
|
||||||
|
(auth.password ? unescape(encodeURIComponent(auth.password)) : '')
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,5 +67,4 @@ export default (config) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return newConfig;
|
return newConfig;
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ function speedometer(samplesCount, min) {
|
|||||||
|
|
||||||
const passed = startedAt && now - startedAt;
|
const passed = startedAt && now - startedAt;
|
||||||
|
|
||||||
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
return passed ? Math.round((bytesCount * 1000) / passed) : undefined;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ function throttle(fn, freq) {
|
|||||||
timer = null;
|
timer = null;
|
||||||
}
|
}
|
||||||
fn(...args);
|
fn(...args);
|
||||||
}
|
};
|
||||||
|
|
||||||
const throttled = (...args) => {
|
const throttled = (...args) => {
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
@@ -30,11 +30,11 @@ function throttle(fn, freq) {
|
|||||||
if (!timer) {
|
if (!timer) {
|
||||||
timer = setTimeout(() => {
|
timer = setTimeout(() => {
|
||||||
timer = null;
|
timer = null;
|
||||||
invoke(lastArgs)
|
invoke(lastArgs);
|
||||||
}, threshold - passed);
|
}, threshold - passed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
const flush = () => lastArgs && invoke(lastArgs);
|
const flush = () => lastArgs && invoke(lastArgs);
|
||||||
|
|
||||||
|
|||||||
+28
-15
@@ -38,11 +38,14 @@ function removeBrackets(key) {
|
|||||||
*/
|
*/
|
||||||
function renderKey(path, key, dots) {
|
function renderKey(path, key, dots) {
|
||||||
if (!path) return key;
|
if (!path) return key;
|
||||||
return path.concat(key).map(function each(token, i) {
|
return path
|
||||||
|
.concat(key)
|
||||||
|
.map(function each(token, i) {
|
||||||
// eslint-disable-next-line no-param-reassign
|
// eslint-disable-next-line no-param-reassign
|
||||||
token = removeBrackets(token);
|
token = removeBrackets(token);
|
||||||
return !dots && i ? '[' + token + ']' : token;
|
return !dots && i ? '[' + token + ']' : token;
|
||||||
}).join(dots ? '.' : '');
|
})
|
||||||
|
.join(dots ? '.' : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -92,21 +95,26 @@ function toFormData(obj, formData, options) {
|
|||||||
formData = formData || new (PlatformFormData || FormData)();
|
formData = formData || new (PlatformFormData || FormData)();
|
||||||
|
|
||||||
// eslint-disable-next-line no-param-reassign
|
// eslint-disable-next-line no-param-reassign
|
||||||
options = utils.toFlatObject(options, {
|
options = utils.toFlatObject(
|
||||||
|
options,
|
||||||
|
{
|
||||||
metaTokens: true,
|
metaTokens: true,
|
||||||
dots: false,
|
dots: false,
|
||||||
indexes: false
|
indexes: false,
|
||||||
}, false, function defined(option, source) {
|
},
|
||||||
|
false,
|
||||||
|
function defined(option, source) {
|
||||||
// eslint-disable-next-line no-eq-null,eqeqeq
|
// eslint-disable-next-line no-eq-null,eqeqeq
|
||||||
return !utils.isUndefined(source[option]);
|
return !utils.isUndefined(source[option]);
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const metaTokens = options.metaTokens;
|
const metaTokens = options.metaTokens;
|
||||||
// eslint-disable-next-line no-use-before-define
|
// eslint-disable-next-line no-use-before-define
|
||||||
const visitor = options.visitor || defaultVisitor;
|
const visitor = options.visitor || defaultVisitor;
|
||||||
const dots = options.dots;
|
const dots = options.dots;
|
||||||
const indexes = options.indexes;
|
const indexes = options.indexes;
|
||||||
const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
|
const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
|
||||||
const useBlob = _Blob && utils.isSpecCompliantForm(formData);
|
const useBlob = _Blob && utils.isSpecCompliantForm(formData);
|
||||||
|
|
||||||
if (!utils.isFunction(visitor)) {
|
if (!utils.isFunction(visitor)) {
|
||||||
@@ -156,15 +164,20 @@ function toFormData(obj, formData, options) {
|
|||||||
value = JSON.stringify(value);
|
value = JSON.stringify(value);
|
||||||
} else if (
|
} else if (
|
||||||
(utils.isArray(value) && isFlatArray(value)) ||
|
(utils.isArray(value) && isFlatArray(value)) ||
|
||||||
((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))
|
((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value)))
|
||||||
)) {
|
) {
|
||||||
// eslint-disable-next-line no-param-reassign
|
// eslint-disable-next-line no-param-reassign
|
||||||
key = removeBrackets(key);
|
key = removeBrackets(key);
|
||||||
|
|
||||||
arr.forEach(function each(el, index) {
|
arr.forEach(function each(el, index) {
|
||||||
!(utils.isUndefined(el) || el === null) && formData.append(
|
!(utils.isUndefined(el) || el === null) &&
|
||||||
|
formData.append(
|
||||||
// eslint-disable-next-line no-nested-ternary
|
// eslint-disable-next-line no-nested-ternary
|
||||||
indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
|
indexes === true
|
||||||
|
? renderKey([key], index, dots)
|
||||||
|
: indexes === null
|
||||||
|
? key
|
||||||
|
: key + '[]',
|
||||||
convertValue(el)
|
convertValue(el)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -186,7 +199,7 @@ function toFormData(obj, formData, options) {
|
|||||||
const exposedHelpers = Object.assign(predicates, {
|
const exposedHelpers = Object.assign(predicates, {
|
||||||
defaultVisitor,
|
defaultVisitor,
|
||||||
convertValue,
|
convertValue,
|
||||||
isVisitable
|
isVisitable,
|
||||||
});
|
});
|
||||||
|
|
||||||
function build(value, path) {
|
function build(value, path) {
|
||||||
@@ -199,9 +212,9 @@ function toFormData(obj, formData, options) {
|
|||||||
stack.push(value);
|
stack.push(value);
|
||||||
|
|
||||||
utils.forEach(value, function each(el, key) {
|
utils.forEach(value, function each(el, key) {
|
||||||
const result = !(utils.isUndefined(el) || el === null) && visitor.call(
|
const result =
|
||||||
formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
|
!(utils.isUndefined(el) || el === null) &&
|
||||||
);
|
visitor.call(formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers);
|
||||||
|
|
||||||
if (result === true) {
|
if (result === true) {
|
||||||
build(el, path ? path.concat(key) : [key]);
|
build(el, path ? path.concat(key) : [key]);
|
||||||
|
|||||||
@@ -14,6 +14,6 @@ export default function toURLEncodedForm(data, options) {
|
|||||||
|
|
||||||
return helpers.defaultVisitor.apply(this, arguments);
|
return helpers.defaultVisitor.apply(this, arguments);
|
||||||
},
|
},
|
||||||
...options
|
...options,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-11
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
export const streamChunk = function* (chunk, chunkSize) {
|
export const streamChunk = function* (chunk, chunkSize) {
|
||||||
let len = chunk.byteLength;
|
let len = chunk.byteLength;
|
||||||
|
|
||||||
@@ -15,13 +14,13 @@ export const streamChunk = function* (chunk, chunkSize) {
|
|||||||
yield chunk.slice(pos, end);
|
yield chunk.slice(pos, end);
|
||||||
pos = end;
|
pos = end;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export const readBytes = async function* (iterable, chunkSize) {
|
export const readBytes = async function* (iterable, chunkSize) {
|
||||||
for await (const chunk of readStream(iterable)) {
|
for await (const chunk of readStream(iterable)) {
|
||||||
yield* streamChunk(chunk, chunkSize);
|
yield* streamChunk(chunk, chunkSize);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
const readStream = async function* (stream) {
|
const readStream = async function* (stream) {
|
||||||
if (stream[Symbol.asyncIterator]) {
|
if (stream[Symbol.asyncIterator]) {
|
||||||
@@ -41,7 +40,7 @@ const readStream = async function* (stream) {
|
|||||||
} finally {
|
} finally {
|
||||||
await reader.cancel();
|
await reader.cancel();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
export const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
||||||
const iterator = readBytes(stream, chunkSize);
|
const iterator = readBytes(stream, chunkSize);
|
||||||
@@ -53,9 +52,10 @@ export const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|||||||
done = true;
|
done = true;
|
||||||
onFinish && onFinish(e);
|
onFinish && onFinish(e);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
return new ReadableStream({
|
return new ReadableStream(
|
||||||
|
{
|
||||||
async pull(controller) {
|
async pull(controller) {
|
||||||
try {
|
try {
|
||||||
const { done, value } = await iterator.next();
|
const { done, value } = await iterator.next();
|
||||||
@@ -68,7 +68,7 @@ export const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|||||||
|
|
||||||
let len = value.byteLength;
|
let len = value.byteLength;
|
||||||
if (onProgress) {
|
if (onProgress) {
|
||||||
let loadedBytes = bytes += len;
|
let loadedBytes = (bytes += len);
|
||||||
onProgress(loadedBytes);
|
onProgress(loadedBytes);
|
||||||
}
|
}
|
||||||
controller.enqueue(new Uint8Array(value));
|
controller.enqueue(new Uint8Array(value));
|
||||||
@@ -80,8 +80,10 @@ export const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|||||||
cancel(reason) {
|
cancel(reason) {
|
||||||
_onFinish(reason);
|
_onFinish(reason);
|
||||||
return iterator.return();
|
return iterator.return();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
highWaterMark: 2,
|
||||||
}
|
}
|
||||||
}, {
|
);
|
||||||
highWaterMark: 2
|
};
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -25,7 +25,15 @@ const deprecatedWarnings = {};
|
|||||||
*/
|
*/
|
||||||
validators.transitional = function transitional(validator, version, message) {
|
validators.transitional = function transitional(validator, version, message) {
|
||||||
function formatMessage(opt, desc) {
|
function formatMessage(opt, desc) {
|
||||||
return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
|
return (
|
||||||
|
'[Axios v' +
|
||||||
|
VERSION +
|
||||||
|
"] Transitional option '" +
|
||||||
|
opt +
|
||||||
|
"'" +
|
||||||
|
desc +
|
||||||
|
(message ? '. ' + message : '')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line func-names
|
// eslint-disable-next-line func-names
|
||||||
@@ -57,7 +65,7 @@ validators.spelling = function spelling(correctSpelling) {
|
|||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
||||||
return true;
|
return true;
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -83,7 +91,10 @@ function assertOptions(options, schema, allowUnknown) {
|
|||||||
const value = options[opt];
|
const value = options[opt];
|
||||||
const result = value === undefined || validator(value, opt, options);
|
const result = value === undefined || validator(value, opt, options);
|
||||||
if (result !== true) {
|
if (result !== true) {
|
||||||
throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
|
throw new AxiosError(
|
||||||
|
'option ' + opt + ' must be ' + result,
|
||||||
|
AxiosError.ERR_BAD_OPTION_VALUE
|
||||||
|
);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -95,5 +106,5 @@ function assertOptions(options, schema, allowUnknown) {
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
assertOptions,
|
assertOptions,
|
||||||
validators
|
validators,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
'use strict'
|
'use strict';
|
||||||
|
|
||||||
export default typeof Blob !== 'undefined' ? Blob : null
|
export default typeof Blob !== 'undefined' ? Blob : null;
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import URLSearchParams from './classes/URLSearchParams.js'
|
import URLSearchParams from './classes/URLSearchParams.js';
|
||||||
import FormData from './classes/FormData.js'
|
import FormData from './classes/FormData.js';
|
||||||
import Blob from './classes/Blob.js'
|
import Blob from './classes/Blob.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
isBrowser: true,
|
isBrowser: true,
|
||||||
classes: {
|
classes: {
|
||||||
URLSearchParams,
|
URLSearchParams,
|
||||||
FormData,
|
FormData,
|
||||||
Blob
|
Blob,
|
||||||
},
|
},
|
||||||
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
|
protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
||||||
|
|
||||||
const _navigator = typeof navigator === 'object' && navigator || undefined;
|
const _navigator = (typeof navigator === 'object' && navigator) || undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if we're running in a standard browser environment
|
* Determine if we're running in a standard browser environment
|
||||||
@@ -19,7 +19,8 @@ const _navigator = typeof navigator === 'object' && navigator || undefined;
|
|||||||
*
|
*
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
const hasStandardBrowserEnv = hasBrowserEnv &&
|
const hasStandardBrowserEnv =
|
||||||
|
hasBrowserEnv &&
|
||||||
(!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
|
(!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,12 +41,12 @@ const hasStandardBrowserWebWorkerEnv = (() => {
|
|||||||
);
|
);
|
||||||
})();
|
})();
|
||||||
|
|
||||||
const origin = hasBrowserEnv && window.location.href || 'http://localhost';
|
const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
hasBrowserEnv,
|
hasBrowserEnv,
|
||||||
hasStandardBrowserWebWorkerEnv,
|
hasStandardBrowserWebWorkerEnv,
|
||||||
hasStandardBrowserEnv,
|
hasStandardBrowserEnv,
|
||||||
_navigator as navigator,
|
_navigator as navigator,
|
||||||
origin
|
origin,
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -3,5 +3,5 @@ import * as utils from './common/utils.js';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
...utils,
|
...utils,
|
||||||
...platform
|
...platform,
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import crypto from 'crypto';
|
import crypto from 'crypto';
|
||||||
import URLSearchParams from './classes/URLSearchParams.js'
|
import URLSearchParams from './classes/URLSearchParams.js';
|
||||||
import FormData from './classes/FormData.js'
|
import FormData from './classes/FormData.js';
|
||||||
|
|
||||||
const ALPHA = 'abcdefghijklmnopqrstuvwxyz'
|
const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
|
||||||
|
|
||||||
const DIGIT = '0123456789';
|
const DIGIT = '0123456789';
|
||||||
|
|
||||||
const ALPHABET = {
|
const ALPHABET = {
|
||||||
DIGIT,
|
DIGIT,
|
||||||
ALPHA,
|
ALPHA,
|
||||||
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
|
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT,
|
||||||
}
|
};
|
||||||
|
|
||||||
const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
||||||
let str = '';
|
let str = '';
|
||||||
@@ -22,17 +22,16 @@ const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
isNode: true,
|
isNode: true,
|
||||||
classes: {
|
classes: {
|
||||||
URLSearchParams,
|
URLSearchParams,
|
||||||
FormData,
|
FormData,
|
||||||
Blob: typeof Blob !== 'undefined' && Blob || null
|
Blob: (typeof Blob !== 'undefined' && Blob) || null,
|
||||||
},
|
},
|
||||||
ALPHABET,
|
ALPHABET,
|
||||||
generateString,
|
generateString,
|
||||||
protocols: [ 'http', 'https', 'file', 'data' ]
|
protocols: ['http', 'https', 'file', 'data'],
|
||||||
};
|
};
|
||||||
|
|||||||
+57
-86
@@ -1,6 +1,6 @@
|
|||||||
"use strict";
|
'use strict';
|
||||||
|
|
||||||
import bind from "./helpers/bind.js";
|
import bind from './helpers/bind.js';
|
||||||
|
|
||||||
// utils is a library of generic helper functions non-specific to axios
|
// utils is a library of generic helper functions non-specific to axios
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ const { isArray } = Array;
|
|||||||
*
|
*
|
||||||
* @returns {boolean} True if the value is undefined, otherwise false
|
* @returns {boolean} True if the value is undefined, otherwise false
|
||||||
*/
|
*/
|
||||||
const isUndefined = typeOfTest("undefined");
|
const isUndefined = typeOfTest('undefined');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if a value is a Buffer
|
* Determine if a value is a Buffer
|
||||||
@@ -63,7 +63,7 @@ function isBuffer(val) {
|
|||||||
*
|
*
|
||||||
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
||||||
*/
|
*/
|
||||||
const isArrayBuffer = kindOfTest("ArrayBuffer");
|
const isArrayBuffer = kindOfTest('ArrayBuffer');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if a value is a view on an ArrayBuffer
|
* Determine if a value is a view on an ArrayBuffer
|
||||||
@@ -74,7 +74,7 @@ const isArrayBuffer = kindOfTest("ArrayBuffer");
|
|||||||
*/
|
*/
|
||||||
function isArrayBufferView(val) {
|
function isArrayBufferView(val) {
|
||||||
let result;
|
let result;
|
||||||
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
|
if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
|
||||||
result = ArrayBuffer.isView(val);
|
result = ArrayBuffer.isView(val);
|
||||||
} else {
|
} else {
|
||||||
result = val && val.buffer && isArrayBuffer(val.buffer);
|
result = val && val.buffer && isArrayBuffer(val.buffer);
|
||||||
@@ -89,7 +89,7 @@ function isArrayBufferView(val) {
|
|||||||
*
|
*
|
||||||
* @returns {boolean} True if value is a String, otherwise false
|
* @returns {boolean} True if value is a String, otherwise false
|
||||||
*/
|
*/
|
||||||
const isString = typeOfTest("string");
|
const isString = typeOfTest('string');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if a value is a Function
|
* Determine if a value is a Function
|
||||||
@@ -97,7 +97,7 @@ const isString = typeOfTest("string");
|
|||||||
* @param {*} val The value to test
|
* @param {*} val The value to test
|
||||||
* @returns {boolean} True if value is a Function, otherwise false
|
* @returns {boolean} True if value is a Function, otherwise false
|
||||||
*/
|
*/
|
||||||
const isFunction = typeOfTest("function");
|
const isFunction = typeOfTest('function');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if a value is a Number
|
* Determine if a value is a Number
|
||||||
@@ -106,7 +106,7 @@ const isFunction = typeOfTest("function");
|
|||||||
*
|
*
|
||||||
* @returns {boolean} True if value is a Number, otherwise false
|
* @returns {boolean} True if value is a Number, otherwise false
|
||||||
*/
|
*/
|
||||||
const isNumber = typeOfTest("number");
|
const isNumber = typeOfTest('number');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if a value is an Object
|
* Determine if a value is an Object
|
||||||
@@ -115,7 +115,7 @@ const isNumber = typeOfTest("number");
|
|||||||
*
|
*
|
||||||
* @returns {boolean} True if value is an Object, otherwise false
|
* @returns {boolean} True if value is an Object, otherwise false
|
||||||
*/
|
*/
|
||||||
const isObject = (thing) => thing !== null && typeof thing === "object";
|
const isObject = (thing) => thing !== null && typeof thing === 'object';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if a value is a Boolean
|
* Determine if a value is a Boolean
|
||||||
@@ -133,7 +133,7 @@ const isBoolean = (thing) => thing === true || thing === false;
|
|||||||
* @returns {boolean} True if value is a plain Object, otherwise false
|
* @returns {boolean} True if value is a plain Object, otherwise false
|
||||||
*/
|
*/
|
||||||
const isPlainObject = (val) => {
|
const isPlainObject = (val) => {
|
||||||
if (kindOf(val) !== "object") {
|
if (kindOf(val) !== 'object') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,10 +161,7 @@ const isEmptyObject = (val) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return (
|
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
||||||
Object.keys(val).length === 0 &&
|
|
||||||
Object.getPrototypeOf(val) === Object.prototype
|
|
||||||
);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Fallback for any other objects that might cause RangeError with Object.keys()
|
// Fallback for any other objects that might cause RangeError with Object.keys()
|
||||||
return false;
|
return false;
|
||||||
@@ -178,7 +175,7 @@ const isEmptyObject = (val) => {
|
|||||||
*
|
*
|
||||||
* @returns {boolean} True if value is a Date, otherwise false
|
* @returns {boolean} True if value is a Date, otherwise false
|
||||||
*/
|
*/
|
||||||
const isDate = kindOfTest("Date");
|
const isDate = kindOfTest('Date');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if a value is a File
|
* Determine if a value is a File
|
||||||
@@ -187,7 +184,7 @@ const isDate = kindOfTest("Date");
|
|||||||
*
|
*
|
||||||
* @returns {boolean} True if value is a File, otherwise false
|
* @returns {boolean} True if value is a File, otherwise false
|
||||||
*/
|
*/
|
||||||
const isFile = kindOfTest("File");
|
const isFile = kindOfTest('File');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if a value is a Blob
|
* Determine if a value is a Blob
|
||||||
@@ -196,7 +193,7 @@ const isFile = kindOfTest("File");
|
|||||||
*
|
*
|
||||||
* @returns {boolean} True if value is a Blob, otherwise false
|
* @returns {boolean} True if value is a Blob, otherwise false
|
||||||
*/
|
*/
|
||||||
const isBlob = kindOfTest("Blob");
|
const isBlob = kindOfTest('Blob');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if a value is a FileList
|
* Determine if a value is a FileList
|
||||||
@@ -205,7 +202,7 @@ const isBlob = kindOfTest("Blob");
|
|||||||
*
|
*
|
||||||
* @returns {boolean} True if value is a File, otherwise false
|
* @returns {boolean} True if value is a File, otherwise false
|
||||||
*/
|
*/
|
||||||
const isFileList = kindOfTest("FileList");
|
const isFileList = kindOfTest('FileList');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if a value is a Stream
|
* Determine if a value is a Stream
|
||||||
@@ -227,13 +224,13 @@ const isFormData = (thing) => {
|
|||||||
let kind;
|
let kind;
|
||||||
return (
|
return (
|
||||||
thing &&
|
thing &&
|
||||||
((typeof FormData === "function" && thing instanceof FormData) ||
|
((typeof FormData === 'function' && thing instanceof FormData) ||
|
||||||
(isFunction(thing.append) &&
|
(isFunction(thing.append) &&
|
||||||
((kind = kindOf(thing)) === "formdata" ||
|
((kind = kindOf(thing)) === 'formdata' ||
|
||||||
// detect form-data instance
|
// detect form-data instance
|
||||||
(kind === "object" &&
|
(kind === 'object' &&
|
||||||
isFunction(thing.toString) &&
|
isFunction(thing.toString) &&
|
||||||
thing.toString() === "[object FormData]"))))
|
thing.toString() === '[object FormData]'))))
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -244,13 +241,13 @@ const isFormData = (thing) => {
|
|||||||
*
|
*
|
||||||
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
||||||
*/
|
*/
|
||||||
const isURLSearchParams = kindOfTest("URLSearchParams");
|
const isURLSearchParams = kindOfTest('URLSearchParams');
|
||||||
|
|
||||||
const [isReadableStream, isRequest, isResponse, isHeaders] = [
|
const [isReadableStream, isRequest, isResponse, isHeaders] = [
|
||||||
"ReadableStream",
|
'ReadableStream',
|
||||||
"Request",
|
'Request',
|
||||||
"Response",
|
'Response',
|
||||||
"Headers",
|
'Headers',
|
||||||
].map(kindOfTest);
|
].map(kindOfTest);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -260,9 +257,9 @@ const [isReadableStream, isRequest, isResponse, isHeaders] = [
|
|||||||
*
|
*
|
||||||
* @returns {String} The String freed of excess whitespace
|
* @returns {String} The String freed of excess whitespace
|
||||||
*/
|
*/
|
||||||
const trim = (str) =>
|
const trim = (str) => {
|
||||||
str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* Iterate over an Array or an Object invoking a function for each item.
|
* Iterate over an Array or an Object invoking a function for each item.
|
||||||
*
|
*
|
||||||
@@ -281,7 +278,7 @@ const trim = (str) =>
|
|||||||
*/
|
*/
|
||||||
function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
||||||
// Don't bother if no value provided
|
// Don't bother if no value provided
|
||||||
if (obj === null || typeof obj === "undefined") {
|
if (obj === null || typeof obj === 'undefined') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,7 +286,7 @@ function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|||||||
let l;
|
let l;
|
||||||
|
|
||||||
// Force an array if not already something iterable
|
// Force an array if not already something iterable
|
||||||
if (typeof obj !== "object") {
|
if (typeof obj !== 'object') {
|
||||||
/*eslint no-param-reassign:0*/
|
/*eslint no-param-reassign:0*/
|
||||||
obj = [obj];
|
obj = [obj];
|
||||||
}
|
}
|
||||||
@@ -306,9 +303,7 @@ function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Iterate over object keys
|
// Iterate over object keys
|
||||||
const keys = allOwnKeys
|
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
||||||
? Object.getOwnPropertyNames(obj)
|
|
||||||
: Object.keys(obj);
|
|
||||||
const len = keys.length;
|
const len = keys.length;
|
||||||
let key;
|
let key;
|
||||||
|
|
||||||
@@ -339,16 +334,11 @@ function findKey(obj, key) {
|
|||||||
|
|
||||||
const _global = (() => {
|
const _global = (() => {
|
||||||
/*eslint no-undef:0*/
|
/*eslint no-undef:0*/
|
||||||
if (typeof globalThis !== "undefined") return globalThis;
|
if (typeof globalThis !== 'undefined') return globalThis;
|
||||||
return typeof self !== "undefined"
|
return typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : global;
|
||||||
? self
|
|
||||||
: typeof window !== "undefined"
|
|
||||||
? window
|
|
||||||
: global;
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
const isContextDefined = (context) =>
|
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
||||||
!isUndefined(context) && context !== _global;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Accepts varargs expecting each argument to be an object, then
|
* Accepts varargs expecting each argument to be an object, then
|
||||||
@@ -373,7 +363,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|||||||
const result = {};
|
const result = {};
|
||||||
const assignValue = (val, key) => {
|
const assignValue = (val, key) => {
|
||||||
// Skip dangerous property names to prevent prototype pollution
|
// Skip dangerous property names to prevent prototype pollution
|
||||||
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -426,7 +416,7 @@ const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ allOwnKeys },
|
{ allOwnKeys }
|
||||||
);
|
);
|
||||||
return a;
|
return a;
|
||||||
};
|
};
|
||||||
@@ -455,17 +445,14 @@ const stripBOM = (content) => {
|
|||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
const inherits = (constructor, superConstructor, props, descriptors) => {
|
const inherits = (constructor, superConstructor, props, descriptors) => {
|
||||||
constructor.prototype = Object.create(
|
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
||||||
superConstructor.prototype,
|
Object.defineProperty(constructor.prototype, 'constructor', {
|
||||||
descriptors,
|
|
||||||
);
|
|
||||||
Object.defineProperty(constructor.prototype, "constructor", {
|
|
||||||
value: constructor,
|
value: constructor,
|
||||||
writable: true,
|
writable: true,
|
||||||
enumerable: false,
|
enumerable: false,
|
||||||
configurable: true,
|
configurable: true,
|
||||||
});
|
});
|
||||||
Object.defineProperty(constructor, "super", {
|
Object.defineProperty(constructor, 'super', {
|
||||||
value: superConstructor.prototype,
|
value: superConstructor.prototype,
|
||||||
});
|
});
|
||||||
props && Object.assign(constructor.prototype, props);
|
props && Object.assign(constructor.prototype, props);
|
||||||
@@ -495,20 +482,13 @@ const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
|
|||||||
i = props.length;
|
i = props.length;
|
||||||
while (i-- > 0) {
|
while (i-- > 0) {
|
||||||
prop = props[i];
|
prop = props[i];
|
||||||
if (
|
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
|
||||||
(!propFilter || propFilter(prop, sourceObj, destObj)) &&
|
|
||||||
!merged[prop]
|
|
||||||
) {
|
|
||||||
destObj[prop] = sourceObj[prop];
|
destObj[prop] = sourceObj[prop];
|
||||||
merged[prop] = true;
|
merged[prop] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sourceObj = filter !== false && getPrototypeOf(sourceObj);
|
sourceObj = filter !== false && getPrototypeOf(sourceObj);
|
||||||
} while (
|
} while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
||||||
sourceObj &&
|
|
||||||
(!filter || filter(sourceObj, destObj)) &&
|
|
||||||
sourceObj !== Object.prototype
|
|
||||||
);
|
|
||||||
|
|
||||||
return destObj;
|
return destObj;
|
||||||
};
|
};
|
||||||
@@ -565,7 +545,7 @@ const isTypedArray = ((TypedArray) => {
|
|||||||
return (thing) => {
|
return (thing) => {
|
||||||
return TypedArray && thing instanceof TypedArray;
|
return TypedArray && thing instanceof TypedArray;
|
||||||
};
|
};
|
||||||
})(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
|
})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For each entry in the object, call the function with the key and value.
|
* For each entry in the object, call the function with the key and value.
|
||||||
@@ -608,12 +588,10 @@ const matchAll = (regExp, str) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
|
/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
|
||||||
const isHTMLForm = kindOfTest("HTMLFormElement");
|
const isHTMLForm = kindOfTest('HTMLFormElement');
|
||||||
|
|
||||||
const toCamelCase = (str) => {
|
const toCamelCase = (str) => {
|
||||||
return str
|
return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
|
||||||
.toLowerCase()
|
|
||||||
.replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
|
|
||||||
return p1.toUpperCase() + p2;
|
return p1.toUpperCase() + p2;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -632,7 +610,7 @@ const hasOwnProperty = (
|
|||||||
*
|
*
|
||||||
* @returns {boolean} True if value is a RegExp object, otherwise false
|
* @returns {boolean} True if value is a RegExp object, otherwise false
|
||||||
*/
|
*/
|
||||||
const isRegExp = kindOfTest("RegExp");
|
const isRegExp = kindOfTest('RegExp');
|
||||||
|
|
||||||
const reduceDescriptors = (obj, reducer) => {
|
const reduceDescriptors = (obj, reducer) => {
|
||||||
const descriptors = Object.getOwnPropertyDescriptors(obj);
|
const descriptors = Object.getOwnPropertyDescriptors(obj);
|
||||||
@@ -656,10 +634,7 @@ const reduceDescriptors = (obj, reducer) => {
|
|||||||
const freezeMethods = (obj) => {
|
const freezeMethods = (obj) => {
|
||||||
reduceDescriptors(obj, (descriptor, name) => {
|
reduceDescriptors(obj, (descriptor, name) => {
|
||||||
// skip restricted props in strict mode
|
// skip restricted props in strict mode
|
||||||
if (
|
if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
||||||
isFunction(obj) &&
|
|
||||||
["arguments", "caller", "callee"].indexOf(name) !== -1
|
|
||||||
) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -669,7 +644,7 @@ const freezeMethods = (obj) => {
|
|||||||
|
|
||||||
descriptor.enumerable = false;
|
descriptor.enumerable = false;
|
||||||
|
|
||||||
if ("writable" in descriptor) {
|
if ('writable' in descriptor) {
|
||||||
descriptor.writable = false;
|
descriptor.writable = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -691,9 +666,7 @@ const toObjectSet = (arrayOrString, delimiter) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
isArray(arrayOrString)
|
isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
|
||||||
? define(arrayOrString)
|
|
||||||
: define(String(arrayOrString).split(delimiter));
|
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
};
|
};
|
||||||
@@ -701,9 +674,7 @@ const toObjectSet = (arrayOrString, delimiter) => {
|
|||||||
const noop = () => {};
|
const noop = () => {};
|
||||||
|
|
||||||
const toFiniteNumber = (value, defaultValue) => {
|
const toFiniteNumber = (value, defaultValue) => {
|
||||||
return value != null && Number.isFinite((value = +value))
|
return value != null && Number.isFinite((value = +value)) ? value : defaultValue;
|
||||||
? value
|
|
||||||
: defaultValue;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -717,7 +688,7 @@ function isSpecCompliantForm(thing) {
|
|||||||
return !!(
|
return !!(
|
||||||
thing &&
|
thing &&
|
||||||
isFunction(thing.append) &&
|
isFunction(thing.append) &&
|
||||||
thing[toStringTag] === "FormData" &&
|
thing[toStringTag] === 'FormData' &&
|
||||||
thing[iterator]
|
thing[iterator]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -736,7 +707,7 @@ const toJSONObject = (obj) => {
|
|||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!("toJSON" in source)) {
|
if (!('toJSON' in source)) {
|
||||||
stack[i] = source;
|
stack[i] = source;
|
||||||
const target = isArray(source) ? [] : {};
|
const target = isArray(source) ? [] : {};
|
||||||
|
|
||||||
@@ -757,7 +728,7 @@ const toJSONObject = (obj) => {
|
|||||||
return visit(obj, 0);
|
return visit(obj, 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
const isAsyncFn = kindOfTest("AsyncFunction");
|
const isAsyncFn = kindOfTest('AsyncFunction');
|
||||||
|
|
||||||
const isThenable = (thing) =>
|
const isThenable = (thing) =>
|
||||||
thing &&
|
thing &&
|
||||||
@@ -776,27 +747,27 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|||||||
return postMessageSupported
|
return postMessageSupported
|
||||||
? ((token, callbacks) => {
|
? ((token, callbacks) => {
|
||||||
_global.addEventListener(
|
_global.addEventListener(
|
||||||
"message",
|
'message',
|
||||||
({ source, data }) => {
|
({ source, data }) => {
|
||||||
if (source === _global && data === token) {
|
if (source === _global && data === token) {
|
||||||
callbacks.length && callbacks.shift()();
|
callbacks.length && callbacks.shift()();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
false,
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
return (cb) => {
|
return (cb) => {
|
||||||
callbacks.push(cb);
|
callbacks.push(cb);
|
||||||
_global.postMessage(token, "*");
|
_global.postMessage(token, '*');
|
||||||
};
|
};
|
||||||
})(`axios@${Math.random()}`, [])
|
})(`axios@${Math.random()}`, [])
|
||||||
: (cb) => setTimeout(cb);
|
: (cb) => setTimeout(cb);
|
||||||
})(typeof setImmediate === "function", isFunction(_global.postMessage));
|
})(typeof setImmediate === 'function', isFunction(_global.postMessage));
|
||||||
|
|
||||||
const asap =
|
const asap =
|
||||||
typeof queueMicrotask !== "undefined"
|
typeof queueMicrotask !== 'undefined'
|
||||||
? queueMicrotask.bind(_global)
|
? queueMicrotask.bind(_global)
|
||||||
: (typeof process !== "undefined" && process.nextTick) || _setImmediate;
|
: (typeof process !== 'undefined' && process.nextTick) || _setImmediate;
|
||||||
|
|
||||||
// *********************
|
// *********************
|
||||||
|
|
||||||
|
|||||||
Generated
+856
-293
File diff suppressed because it is too large
Load Diff
+6
-2
@@ -2,7 +2,7 @@
|
|||||||
"name": "axios",
|
"name": "axios",
|
||||||
"version": "1.13.5",
|
"version": "1.13.5",
|
||||||
"description": "Promise based HTTP client for the browser and node.js",
|
"description": "Promise based HTTP client for the browser and node.js",
|
||||||
"main": "./dist/node/axios.cjs",
|
"main": "./index.js",
|
||||||
"module": "./index.js",
|
"module": "./index.js",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
@@ -63,7 +63,6 @@
|
|||||||
"prepublishOnly": "npm run test:build:version",
|
"prepublishOnly": "npm run test:build:version",
|
||||||
"build": "gulp clear && cross-env NODE_ENV=production rollup -c -m",
|
"build": "gulp clear && cross-env NODE_ENV=production rollup -c -m",
|
||||||
"examples": "node ./examples/server.js",
|
"examples": "node ./examples/server.js",
|
||||||
"coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
|
|
||||||
"fix": "eslint --fix lib/**/*.js",
|
"fix": "eslint --fix lib/**/*.js",
|
||||||
"prepare": "husky install && npm run prepare:hooks",
|
"prepare": "husky install && npm run prepare:hooks",
|
||||||
"prepare:hooks": "npx husky set .husky/commit-msg \"npx commitlint --edit $1\""
|
"prepare:hooks": "npx husky set .husky/commit-msg \"npx commitlint --edit $1\""
|
||||||
@@ -131,11 +130,13 @@
|
|||||||
"karma-sauce-launcher": "^4.3.6",
|
"karma-sauce-launcher": "^4.3.6",
|
||||||
"karma-sinon": "^1.0.5",
|
"karma-sinon": "^1.0.5",
|
||||||
"karma-sourcemap-loader": "^0.4.0",
|
"karma-sourcemap-loader": "^0.4.0",
|
||||||
|
"lint-staged": "^15.2.10",
|
||||||
"memoizee": "^0.4.17",
|
"memoizee": "^0.4.17",
|
||||||
"minimist": "^1.2.8",
|
"minimist": "^1.2.8",
|
||||||
"mocha": "^10.8.2",
|
"mocha": "^10.8.2",
|
||||||
"multer": "^1.4.4",
|
"multer": "^1.4.4",
|
||||||
"pacote": "^20.0.0",
|
"pacote": "^20.0.0",
|
||||||
|
"prettier": "^3.8.1",
|
||||||
"pretty-bytes": "^6.1.1",
|
"pretty-bytes": "^6.1.1",
|
||||||
"rollup": "^2.79.2",
|
"rollup": "^2.79.2",
|
||||||
"rollup-plugin-auto-external": "^2.0.0",
|
"rollup-plugin-auto-external": "^2.0.0",
|
||||||
@@ -202,6 +203,9 @@
|
|||||||
"@commitlint/config-conventional"
|
"@commitlint/config-conventional"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"lint-staged": {
|
||||||
|
"*.{js,cjs,mjs,ts,json,md,yml,yaml}": "prettier --write"
|
||||||
|
},
|
||||||
"c8": {
|
"c8": {
|
||||||
"all": true,
|
"all": true,
|
||||||
"include": [
|
"include": [
|
||||||
|
|||||||
+33
-36
@@ -1,6 +1,6 @@
|
|||||||
import resolve from '@rollup/plugin-node-resolve';
|
import resolve from '@rollup/plugin-node-resolve';
|
||||||
import commonjs from '@rollup/plugin-commonjs';
|
import commonjs from '@rollup/plugin-commonjs';
|
||||||
import {terser} from "rollup-plugin-terser";
|
import { terser } from 'rollup-plugin-terser';
|
||||||
import json from '@rollup/plugin-json';
|
import json from '@rollup/plugin-json';
|
||||||
import { babel } from '@rollup/plugin-babel';
|
import { babel } from '@rollup/plugin-babel';
|
||||||
import autoExternal from 'rollup-plugin-auto-external';
|
import autoExternal from 'rollup-plugin-auto-external';
|
||||||
@@ -8,9 +8,9 @@ import bundleSize from 'rollup-plugin-bundle-size';
|
|||||||
import aliasPlugin from '@rollup/plugin-alias';
|
import aliasPlugin from '@rollup/plugin-alias';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
const lib = require("./package.json");
|
const lib = require('./package.json');
|
||||||
const outputFileName = 'axios';
|
const outputFileName = 'axios';
|
||||||
const name = "axios";
|
const name = 'axios';
|
||||||
const namedInput = './index.js';
|
const namedInput = './index.js';
|
||||||
const defaultInput = './lib/axios.js';
|
const defaultInput = './lib/axios.js';
|
||||||
|
|
||||||
@@ -21,17 +21,16 @@ const buildConfig = ({es5, browser = true, minifiedVersion = true, alias, ...con
|
|||||||
const extArr = ext.split('.');
|
const extArr = ext.split('.');
|
||||||
extArr.shift();
|
extArr.shift();
|
||||||
|
|
||||||
|
|
||||||
const build = ({ minified }) => ({
|
const build = ({ minified }) => ({
|
||||||
input: namedInput,
|
input: namedInput,
|
||||||
...config,
|
...config,
|
||||||
output: {
|
output: {
|
||||||
...config.output,
|
...config.output,
|
||||||
file: `${path.dirname(file)}/${basename}.${(minified ? ['min', ...extArr] : extArr).join('.')}`
|
file: `${path.dirname(file)}/${basename}.${(minified ? ['min', ...extArr] : extArr).join('.')}`,
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
aliasPlugin({
|
aliasPlugin({
|
||||||
entries: alias || []
|
entries: alias || [],
|
||||||
}),
|
}),
|
||||||
json(),
|
json(),
|
||||||
resolve({ browser }),
|
resolve({ browser }),
|
||||||
@@ -39,20 +38,22 @@ const buildConfig = ({es5, browser = true, minifiedVersion = true, alias, ...con
|
|||||||
|
|
||||||
minified && terser(),
|
minified && terser(),
|
||||||
minified && bundleSize(),
|
minified && bundleSize(),
|
||||||
...(es5 ? [babel({
|
...(es5
|
||||||
|
? [
|
||||||
|
babel({
|
||||||
babelHelpers: 'bundled',
|
babelHelpers: 'bundled',
|
||||||
presets: ['@babel/preset-env']
|
presets: ['@babel/preset-env'],
|
||||||
})] : []),
|
}),
|
||||||
...(config.plugins || []),
|
|
||||||
]
|
]
|
||||||
|
: []),
|
||||||
|
...(config.plugins || []),
|
||||||
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
const configs = [
|
const configs = [build({ minified: false })];
|
||||||
build({minified: false}),
|
|
||||||
];
|
|
||||||
|
|
||||||
if (minifiedVersion) {
|
if (minifiedVersion) {
|
||||||
configs.push(build({minified: true}))
|
configs.push(build({ minified: true }));
|
||||||
}
|
}
|
||||||
|
|
||||||
return configs;
|
return configs;
|
||||||
@@ -68,11 +69,11 @@ export default async () => {
|
|||||||
input: namedInput,
|
input: namedInput,
|
||||||
output: {
|
output: {
|
||||||
file: `dist/esm/${outputFileName}.js`,
|
file: `dist/esm/${outputFileName}.js`,
|
||||||
format: "esm",
|
format: 'esm',
|
||||||
preferConst: true,
|
preferConst: true,
|
||||||
exports: "named",
|
exports: 'named',
|
||||||
banner
|
banner,
|
||||||
}
|
},
|
||||||
}),
|
}),
|
||||||
// browser ESM bundle for CDN with fetch adapter only
|
// browser ESM bundle for CDN with fetch adapter only
|
||||||
// Downsizing from 12.97 kB (gzip) to 12.23 kB (gzip)
|
// Downsizing from 12.97 kB (gzip) to 12.23 kB (gzip)
|
||||||
@@ -97,10 +98,10 @@ export default async () => {
|
|||||||
output: {
|
output: {
|
||||||
file: `dist/${outputFileName}.js`,
|
file: `dist/${outputFileName}.js`,
|
||||||
name,
|
name,
|
||||||
format: "umd",
|
format: 'umd',
|
||||||
exports: "default",
|
exports: 'default',
|
||||||
banner
|
banner,
|
||||||
}
|
},
|
||||||
}),
|
}),
|
||||||
|
|
||||||
// Browser CJS bundle
|
// Browser CJS bundle
|
||||||
@@ -111,10 +112,10 @@ export default async () => {
|
|||||||
output: {
|
output: {
|
||||||
file: `dist/browser/${name}.cjs`,
|
file: `dist/browser/${name}.cjs`,
|
||||||
name,
|
name,
|
||||||
format: "cjs",
|
format: 'cjs',
|
||||||
exports: "default",
|
exports: 'default',
|
||||||
banner
|
banner,
|
||||||
}
|
},
|
||||||
}),
|
}),
|
||||||
|
|
||||||
// Node.js commonjs bundle
|
// Node.js commonjs bundle
|
||||||
@@ -122,16 +123,12 @@ export default async () => {
|
|||||||
input: defaultInput,
|
input: defaultInput,
|
||||||
output: {
|
output: {
|
||||||
file: `dist/node/${name}.cjs`,
|
file: `dist/node/${name}.cjs`,
|
||||||
format: "cjs",
|
format: 'cjs',
|
||||||
preferConst: true,
|
preferConst: true,
|
||||||
exports: "default",
|
exports: 'default',
|
||||||
banner
|
banner,
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [autoExternal(), resolve(), commonjs()],
|
||||||
autoExternal(),
|
},
|
||||||
resolve(),
|
];
|
||||||
commonjs()
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
|
|||||||
+42
-19
@@ -1,18 +1,25 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<title>AXIOS | Sandbox</title>
|
<title>AXIOS | Sandbox</title>
|
||||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"/>
|
<link rel="stylesheet" type="text/css"
|
||||||
|
href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" />
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
/*
|
/*
|
||||||
:root & Dark Mode Variables
|
:root & Dark Mode Variables
|
||||||
*/
|
*/
|
||||||
:root {
|
:root {
|
||||||
--bg-color: #f0f4ff; /* main page background */
|
--bg-color: #f0f4ff;
|
||||||
--text-color: #1a1a1a; /* main text color */
|
/* main page background */
|
||||||
--border-color: #cfd8ff; /* default borders */
|
--text-color: #1a1a1a;
|
||||||
--well-bg: rgba(255, 255, 255, 0.9); /* card & well background */
|
/* main text color */
|
||||||
--input-bg: rgba(255, 255, 255, 0.95); /* input background */
|
--border-color: #cfd8ff;
|
||||||
|
/* default borders */
|
||||||
|
--well-bg: rgba(255, 255, 255, 0.9);
|
||||||
|
/* card & well background */
|
||||||
|
--input-bg: rgba(255, 255, 255, 0.95);
|
||||||
|
/* input background */
|
||||||
--footer-text-color: #555;
|
--footer-text-color: #555;
|
||||||
--footer-heading-color: #1a1a1a;
|
--footer-heading-color: #1a1a1a;
|
||||||
--footer-link-color: #5b4bff;
|
--footer-link-color: #5b4bff;
|
||||||
@@ -20,7 +27,8 @@
|
|||||||
--shadow-color: rgba(0, 0, 0, 0.1);
|
--shadow-color: rgba(0, 0, 0, 0.1);
|
||||||
--primary-gradient: linear-gradient(135deg, #6a1bff, #00c3ff);
|
--primary-gradient: linear-gradient(135deg, #6a1bff, #00c3ff);
|
||||||
--btn-hover-gradient: linear-gradient(135deg, #5b00d1, #00aaff);
|
--btn-hover-gradient: linear-gradient(135deg, #5b00d1, #00aaff);
|
||||||
--glass-blur: blur(12px); /* for frosted glass effect */
|
--glass-blur: blur(12px);
|
||||||
|
/* for frosted glass effect */
|
||||||
}
|
}
|
||||||
|
|
||||||
body.dark-mode {
|
body.dark-mode {
|
||||||
@@ -44,7 +52,8 @@
|
|||||||
*/
|
*/
|
||||||
* {
|
* {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
transition: all 0.4s ease; /* smooth transitions everywhere */
|
transition: all 0.4s ease;
|
||||||
|
/* smooth transitions everywhere */
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
@@ -53,9 +62,11 @@
|
|||||||
background: var(--bg-color);
|
background: var(--bg-color);
|
||||||
color: var(--text-color);
|
color: var(--text-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
pre {
|
pre {
|
||||||
min-height: 39px;
|
min-height: 39px;
|
||||||
white-space: pre-wrap; /* wrap long lines instead of stretching the panel */
|
white-space: pre-wrap;
|
||||||
|
/* wrap long lines instead of stretching the panel */
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
@@ -63,11 +74,13 @@
|
|||||||
.box {
|
.box {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr 1fr;
|
grid-template-columns: 1fr 1fr;
|
||||||
grid-gap: 40px; /* Increased gap between input and response columns */
|
grid-gap: 40px;
|
||||||
|
/* Increased gap between input and response columns */
|
||||||
}
|
}
|
||||||
|
|
||||||
.response {
|
.response {
|
||||||
min-width: 0; /* prevents content overflow from pushing layout */
|
min-width: 0;
|
||||||
|
/* prevents content overflow from pushing layout */
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +89,8 @@
|
|||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 2rem; /* Added space below the header */
|
margin-bottom: 2rem;
|
||||||
|
/* Added space below the header */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -90,7 +104,8 @@
|
|||||||
border-radius: 16px;
|
border-radius: 16px;
|
||||||
padding: 14px 16px;
|
padding: 14px 16px;
|
||||||
box-shadow: 0 10px 25px -8px var(--shadow-color);
|
box-shadow: 0 10px 25px -8px var(--shadow-color);
|
||||||
backdrop-filter: var(--glass-blur); /* glass effect */
|
backdrop-filter: var(--glass-blur);
|
||||||
|
/* glass effect */
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-control {
|
.form-control {
|
||||||
@@ -98,18 +113,23 @@
|
|||||||
color: var(--text-color);
|
color: var(--text-color);
|
||||||
border-radius: 16px;
|
border-radius: 16px;
|
||||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||||
outline: none; /* remove default bootstrap focus outline */
|
outline: none;
|
||||||
|
/* remove default bootstrap focus outline */
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-control::placeholder {
|
.form-control::placeholder {
|
||||||
color: #9e9eef; /* subtle placeholder */
|
color: #9e9eef;
|
||||||
|
/* subtle placeholder */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Modern neon focus effect */
|
/* Modern neon focus effect */
|
||||||
.form-control:focus {
|
.form-control:focus {
|
||||||
background: var(--input-bg); /* keep consistent */
|
background: var(--input-bg);
|
||||||
border: 1px solid #ff00ff; /* neon border */
|
/* keep consistent */
|
||||||
box-shadow: 0 0 10px #ff00ff, 0 0 20px #00ffff; /* glowing focus */
|
border: 1px solid #ff00ff;
|
||||||
|
/* neon border */
|
||||||
|
box-shadow: 0 0 10px #ff00ff, 0 0 20px #00ffff;
|
||||||
|
/* glowing focus */
|
||||||
color: var(--text-color);
|
color: var(--text-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,6 +296,7 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="container">
|
<body class="container">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<div style="display: flex; align-items: center;">
|
<div style="display: flex; align-items: center;">
|
||||||
@@ -340,7 +361,8 @@
|
|||||||
|
|
||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="footer-left">
|
<div class="footer-left">
|
||||||
<p class="footer-brand-axios">AXIOS</p><p class="footer-brand-sandbox"> | Sandbox</p>
|
<p class="footer-brand-axios">AXIOS</p>
|
||||||
|
<p class="footer-brand-sandbox"> | Sandbox</p>
|
||||||
<p class="footer-copyright">© <span id="year">2025</span> Axios. All rights reserved.</p>
|
<p class="footer-copyright">© <span id="year">2025</span> Axios. All rights reserved.</p>
|
||||||
</div>
|
</div>
|
||||||
<nav class="footer-nav">
|
<nav class="footer-nav">
|
||||||
@@ -496,4 +518,5 @@
|
|||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
+9
-9
@@ -3,18 +3,18 @@ import axios from '../index.js';
|
|||||||
const URL = 'http://127.0.0.1:3000/api';
|
const URL = 'http://127.0.0.1:3000/api';
|
||||||
const BODY = {
|
const BODY = {
|
||||||
foo: 'bar',
|
foo: 'bar',
|
||||||
baz: 1234
|
baz: 1234,
|
||||||
};
|
};
|
||||||
|
|
||||||
function handleSuccess(data) { console.log(data); }
|
function handleSuccess(data) {
|
||||||
function handleFailure(data) { console.log('error', data); }
|
console.log(data);
|
||||||
|
}
|
||||||
|
function handleFailure(data) {
|
||||||
|
console.log('error', data);
|
||||||
|
}
|
||||||
|
|
||||||
// GET
|
// GET
|
||||||
axios.get(URL, { params: BODY })
|
axios.get(URL, { params: BODY }).then(handleSuccess).catch(handleFailure);
|
||||||
.then(handleSuccess)
|
|
||||||
.catch(handleFailure);
|
|
||||||
|
|
||||||
// POST
|
// POST
|
||||||
axios.post(URL, BODY)
|
axios.post(URL, BODY).then(handleSuccess).catch(handleFailure);
|
||||||
.then(handleSuccess)
|
|
||||||
.catch(handleFailure);
|
|
||||||
|
|||||||
+4
-4
@@ -15,7 +15,7 @@ let server;
|
|||||||
function pipeFileToResponse(res, file, type) {
|
function pipeFileToResponse(res, file, type) {
|
||||||
if (type) {
|
if (type) {
|
||||||
res.writeHead(200, {
|
res.writeHead(200, {
|
||||||
'Content-Type': type
|
'Content-Type': type,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,18 +47,18 @@ function handleApiRequest(req, res) {
|
|||||||
url: req.url,
|
url: req.url,
|
||||||
data: data ? JSON.parse(data) : undefined,
|
data: data ? JSON.parse(data) : undefined,
|
||||||
method: req.method,
|
method: req.method,
|
||||||
headers: req.headers
|
headers: req.headers,
|
||||||
};
|
};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Error:', e.message);
|
console.error('Error:', e.message);
|
||||||
status = 400;
|
status = 400;
|
||||||
result = {
|
result = {
|
||||||
error: e.message
|
error: e.message,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
res.writeHead(status, {
|
res.writeHead(status, {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json',
|
||||||
});
|
});
|
||||||
res.end(JSON.stringify(result));
|
res.end(JSON.stringify(result));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,18 +1,20 @@
|
|||||||
|
|
||||||
export const retryNetwork = async (fn, retries = 3, delay = 1000) => {
|
export const retryNetwork = async (fn, retries = 3, delay = 1000) => {
|
||||||
let attempt = 0, sleep;
|
let attempt = 0,
|
||||||
|
sleep;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
try {
|
try {
|
||||||
return await fn()
|
return await fn();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err.code === 'ERR_NETWORK' && attempt++ < retries) {
|
if (err.code === 'ERR_NETWORK' && attempt++ < retries) {
|
||||||
sleep = attempt * attempt * delay;
|
sleep = attempt * attempt * delay;
|
||||||
console.warn(`[ERR_NETWORK]: Attempt ${attempt}/${retries}${err.config ? ' [' + err.config.url + ']' : ''} sleep [${sleep}ms]`);
|
console.warn(
|
||||||
await new Promise(resolve => setTimeout(resolve, sleep));
|
`[ERR_NETWORK]: Attempt ${attempt}/${retries}${err.config ? ' [' + err.config.url + ']' : ''} sleep [${sleep}ms]`
|
||||||
|
);
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, sleep));
|
||||||
} else {
|
} else {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (true);
|
} while (true);
|
||||||
}
|
};
|
||||||
|
|||||||
+59
-50
@@ -1,22 +1,20 @@
|
|||||||
import http from "http";
|
import http from 'http';
|
||||||
import http2 from "http2";
|
import http2 from 'http2';
|
||||||
import stream from "stream";
|
import stream from 'stream';
|
||||||
import getStream from "get-stream";
|
import getStream from 'get-stream';
|
||||||
import {Throttle} from "stream-throttle";
|
import { Throttle } from 'stream-throttle';
|
||||||
import formidable from "formidable";
|
import formidable from 'formidable';
|
||||||
import selfsigned from 'selfsigned';
|
import selfsigned from 'selfsigned';
|
||||||
|
|
||||||
|
|
||||||
export const LOCAL_SERVER_URL = 'http://localhost:4444';
|
export const LOCAL_SERVER_URL = 'http://localhost:4444';
|
||||||
|
|
||||||
export const SERVER_HANDLER_STREAM_ECHO = (req, res) => req.pipe(res);
|
export const SERVER_HANDLER_STREAM_ECHO = (req, res) => req.pipe(res);
|
||||||
|
|
||||||
export const setTimeoutAsync = (ms) => new Promise(resolve=> setTimeout(resolve, ms));
|
export const setTimeoutAsync = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||||
|
|
||||||
const certificate = selfsigned.generate(null, { keySize: 2048 });
|
const certificate = selfsigned.generate(null, { keySize: 2048 });
|
||||||
|
|
||||||
export const startHTTPServer = (handlerOrOptions, options) => {
|
export const startHTTPServer = (handlerOrOptions, options) => {
|
||||||
|
|
||||||
const {
|
const {
|
||||||
handler,
|
handler,
|
||||||
useBuffering = false,
|
useBuffering = false,
|
||||||
@@ -26,15 +24,22 @@ export const startHTTPServer = (handlerOrOptions, options) => {
|
|||||||
useHTTP2,
|
useHTTP2,
|
||||||
key = certificate.private,
|
key = certificate.private,
|
||||||
cert = certificate.cert,
|
cert = certificate.cert,
|
||||||
} =
|
} = Object.assign(
|
||||||
Object.assign(typeof handlerOrOptions === 'function' ? {
|
typeof handlerOrOptions === 'function'
|
||||||
handler: handlerOrOptions
|
? {
|
||||||
} : handlerOrOptions || {}, options);
|
handler: handlerOrOptions,
|
||||||
|
}
|
||||||
|
: handlerOrOptions || {},
|
||||||
|
options
|
||||||
|
);
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const serverHandler = handler || async function (req, res) {
|
const serverHandler =
|
||||||
|
handler ||
|
||||||
|
async function (req, res) {
|
||||||
try {
|
try {
|
||||||
req.headers['content-length'] && res.setHeader('content-length', req.headers['content-length']);
|
req.headers['content-length'] &&
|
||||||
|
res.setHeader('content-length', req.headers['content-length']);
|
||||||
|
|
||||||
let dataStream = req;
|
let dataStream = req;
|
||||||
|
|
||||||
@@ -45,22 +50,22 @@ export const startHTTPServer = (handlerOrOptions, options) => {
|
|||||||
let streams = [dataStream];
|
let streams = [dataStream];
|
||||||
|
|
||||||
if (rate) {
|
if (rate) {
|
||||||
streams.push(new Throttle({rate}))
|
streams.push(new Throttle({ rate }));
|
||||||
}
|
}
|
||||||
|
|
||||||
streams.push(res);
|
streams.push(res);
|
||||||
|
|
||||||
stream.pipeline(streams, (err) => {
|
stream.pipeline(streams, (err) => {
|
||||||
err && console.log('Server warning: ' + err.message)
|
err && console.log('Server warning: ' + err.message);
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.warn('HTTP server error:', err);
|
console.warn('HTTP server error:', err);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
const server = useHTTP2 ?
|
const server = useHTTP2
|
||||||
http2.createSecureServer({key, cert} , serverHandler) :
|
? http2.createSecureServer({ key, cert }, serverHandler)
|
||||||
http.createServer(serverHandler);
|
: http.createServer(serverHandler);
|
||||||
|
|
||||||
const sessions = new Set();
|
const sessions = new Set();
|
||||||
|
|
||||||
@@ -77,7 +82,7 @@ export const startHTTPServer = (handlerOrOptions, options) => {
|
|||||||
for (const session of sessions) {
|
for (const session of sessions) {
|
||||||
session.destroy();
|
session.destroy();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
server.keepAliveTimeout = keepAlive;
|
server.keepAliveTimeout = keepAlive;
|
||||||
}
|
}
|
||||||
@@ -85,9 +90,8 @@ export const startHTTPServer = (handlerOrOptions, options) => {
|
|||||||
server.listen(port, function (err) {
|
server.listen(port, function (err) {
|
||||||
err ? reject(err) : resolve(this);
|
err ? reject(err) : resolve(this);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
export const stopHTTPServer = async (server, timeout = 10000) => {
|
export const stopHTTPServer = async (server, timeout = 10000) => {
|
||||||
if (server) {
|
if (server) {
|
||||||
@@ -99,9 +103,9 @@ export const stopHTTPServer = async (server, timeout = 10000) => {
|
|||||||
server.closeAllSessions();
|
server.closeAllSessions();
|
||||||
}
|
}
|
||||||
|
|
||||||
await Promise.race([new Promise(resolve => server.close(resolve)), setTimeoutAsync(timeout)]);
|
await Promise.race([new Promise((resolve) => server.close(resolve)), setTimeoutAsync(timeout)]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export const handleFormData = (req) => {
|
export const handleFormData = (req) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
@@ -115,12 +119,13 @@ export const handleFormData = (req) => {
|
|||||||
resolve({ fields, files });
|
resolve({ fields, files });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
export const nodeVersion = process.versions.node.split('.').map(v => parseInt(v, 10));
|
export const nodeVersion = process.versions.node.split('.').map((v) => parseInt(v, 10));
|
||||||
|
|
||||||
export const generateReadable = (length = 1024 * 1024, chunkSize = 10 * 1024, sleep = 50) => {
|
export const generateReadable = (length = 1024 * 1024, chunkSize = 10 * 1024, sleep = 50) => {
|
||||||
return stream.Readable.from(async function* (){
|
return stream.Readable.from(
|
||||||
|
(async function* () {
|
||||||
let dataLength = 0;
|
let dataLength = 0;
|
||||||
|
|
||||||
while (dataLength < length) {
|
while (dataLength < length) {
|
||||||
@@ -136,28 +141,30 @@ export const generateReadable = (length = 1024 * 1024, chunkSize = 10 * 1024, sl
|
|||||||
await setTimeoutAsync(sleep);
|
await setTimeoutAsync(sleep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}());
|
})()
|
||||||
}
|
);
|
||||||
|
};
|
||||||
|
|
||||||
export const makeReadableStream = (chunk = 'chunk', n = 10, timeout = 100) => {
|
export const makeReadableStream = (chunk = 'chunk', n = 10, timeout = 100) => {
|
||||||
return new ReadableStream({
|
return new ReadableStream(
|
||||||
|
{
|
||||||
async pull(controller) {
|
async pull(controller) {
|
||||||
await setTimeoutAsync(timeout);
|
await setTimeoutAsync(timeout);
|
||||||
n-- ? controller.enqueue(chunk) : controller.close();
|
n-- ? controller.enqueue(chunk) : controller.close();
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
highWaterMark: 1
|
highWaterMark: 1,
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
export const makeEchoStream = (echo) => new WritableStream({
|
export const makeEchoStream = (echo) =>
|
||||||
|
new WritableStream({
|
||||||
write(chunk) {
|
write(chunk) {
|
||||||
echo && console.log(`Echo chunk`, chunk);
|
echo && console.log(`Echo chunk`, chunk);
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
|
|
||||||
|
|
||||||
export const startTestServer = async (port) => {
|
export const startTestServer = async (port) => {
|
||||||
const handler = async (req) => {
|
const handler = async (req) => {
|
||||||
@@ -171,7 +178,7 @@ export const startTestServer = async (port) => {
|
|||||||
params,
|
params,
|
||||||
method: req.method,
|
method: req.method,
|
||||||
headers: req.headers,
|
headers: req.headers,
|
||||||
}
|
};
|
||||||
|
|
||||||
const contentType = req.headers['content-type'] || '';
|
const contentType = req.headers['content-type'] || '';
|
||||||
|
|
||||||
@@ -193,12 +200,13 @@ export const startTestServer = async (port) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
body: response
|
body: response,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return await startHTTPServer((req, res) => {
|
return await startHTTPServer(
|
||||||
|
(req, res) => {
|
||||||
// Set CORS headers
|
// Set CORS headers
|
||||||
res.setHeader('Access-Control-Allow-Origin', `*`); // Allows all origins, or specify a domain like 'http://example.com'
|
res.setHeader('Access-Control-Allow-Origin', `*`); // Allows all origins, or specify a domain like 'http://example.com'
|
||||||
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS'); // Allowed HTTP methods
|
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS'); // Allowed HTTP methods
|
||||||
@@ -212,17 +220,18 @@ export const startTestServer = async (port) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Promise.resolve(handler(req, res)).then(response=>{
|
Promise.resolve(handler(req, res)).then((response) => {
|
||||||
const { status = 200, headers = {}, body } = response || {};
|
const { status = 200, headers = {}, body } = response || {};
|
||||||
|
|
||||||
|
|
||||||
res.statusCode = status;
|
res.statusCode = status;
|
||||||
|
|
||||||
Object.entries(headers).forEach((header, value) => {
|
Object.entries(headers).forEach((header, value) => {
|
||||||
res.setHeader(header, value);
|
res.setHeader(header, value);
|
||||||
});
|
});
|
||||||
|
|
||||||
res.end(JSON.stringify(body, null, 2))
|
res.end(JSON.stringify(body, null, 2));
|
||||||
})
|
});
|
||||||
}, {port});
|
},
|
||||||
}
|
{ port }
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
An alert should be shown with the <code>{"name":"axios"}</code>
|
An alert should be shown with the <code>{"name":"axios"}</code>
|
||||||
@@ -18,4 +20,5 @@ An alert should be shown with the <code>{"name":"axios"}</code>
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
An alert should be shown with <code>{"status":"ok"}</code>
|
An alert should be shown with <code>{"status":"ok"}</code>
|
||||||
@@ -17,4 +19,5 @@ An alert should be shown with <code>{"status":"ok"}</code>
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
See your console
|
See your console
|
||||||
<script src="../../dist/axios.js"></script>
|
<script src="../../dist/axios.js"></script>
|
||||||
@@ -34,4 +36,5 @@ See your console
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
+15
-17
@@ -1,11 +1,11 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import * as axios from '../../index.js';
|
import * as axios from '../../index.js';
|
||||||
import axiosFactory from '../../lib/axios.js';
|
import axiosFactory from '../../lib/axios.js';
|
||||||
import utils from "../../lib/utils.js";
|
import utils from '../../lib/utils.js';
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import util from "util";
|
import util from 'util';
|
||||||
import cp from "child_process";
|
import cp from 'child_process';
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
|
|
||||||
const BACKUP_PATH = './backup/';
|
const BACKUP_PATH = './backup/';
|
||||||
@@ -14,14 +14,14 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|||||||
|
|
||||||
const exec = util.promisify(cp.exec);
|
const exec = util.promisify(cp.exec);
|
||||||
|
|
||||||
const spawn = (command, args) => new Promise((resolve, reject) => {
|
const spawn = (command, args) =>
|
||||||
|
new Promise((resolve, reject) => {
|
||||||
cp.spawn(command, args, {
|
cp.spawn(command, args, {
|
||||||
shell: true,
|
shell: true,
|
||||||
stdio: 'inherit'
|
stdio: 'inherit',
|
||||||
}).once('error', reject).on(
|
})
|
||||||
'close',
|
.once('error', reject)
|
||||||
(code) => code ? reject(new Error(`Exit code ${code}`)) : resolve()
|
.on('close', (code) => (code ? reject(new Error(`Exit code ${code}`)) : resolve()));
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const { Axios } = axiosFactory;
|
const { Axios } = axiosFactory;
|
||||||
@@ -30,7 +30,7 @@ const ignoreList = ['default'];
|
|||||||
|
|
||||||
const instance = axiosFactory.create({});
|
const instance = axiosFactory.create({});
|
||||||
|
|
||||||
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||||
|
|
||||||
const remove = async (file) => {
|
const remove = async (file) => {
|
||||||
console.log(`✓ Remove entry '${file}'...`);
|
console.log(`✓ Remove entry '${file}'...`);
|
||||||
@@ -40,10 +40,9 @@ const remove = async (file) => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.warn(err.message);
|
console.warn(err.message);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
describe('module', function () {
|
describe('module', function () {
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
console.log('✓ Creating build backup...');
|
console.log('✓ Creating build backup...');
|
||||||
await fs.copy('./dist/', BACKUP_PATH);
|
await fs.copy('./dist/', BACKUP_PATH);
|
||||||
@@ -59,7 +58,6 @@ describe('module', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('export', function () {
|
describe('export', function () {
|
||||||
|
|
||||||
it('should have consistent ESM export', function () {
|
it('should have consistent ESM export', function () {
|
||||||
const namedExport = {};
|
const namedExport = {};
|
||||||
const factoryExport = {};
|
const factoryExport = {};
|
||||||
@@ -119,7 +117,7 @@ describe('module', function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('TS require(\'axios\')', () => {
|
describe("TS require('axios')", () => {
|
||||||
const pkgPath = path.join(__dirname, './ts-require');
|
const pkgPath = path.join(__dirname, './ts-require');
|
||||||
|
|
||||||
after(async () => {
|
after(async () => {
|
||||||
@@ -133,7 +131,7 @@ describe('module', function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('TS require(\'axios\').default', () => {
|
describe("TS require('axios').default", () => {
|
||||||
const pkgPath = path.join(__dirname, './ts-require-default');
|
const pkgPath = path.join(__dirname, './ts-require-default');
|
||||||
|
|
||||||
after(async () => {
|
after(async () => {
|
||||||
@@ -161,7 +159,7 @@ describe('module', function () {
|
|||||||
|
|
||||||
await spawn(`npm test --prefix ${pkgPath}`, [], {
|
await spawn(`npm test --prefix ${pkgPath}`, [], {
|
||||||
shell: true,
|
shell: true,
|
||||||
stdio: 'pipe'
|
stdio: 'pipe',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -178,7 +176,7 @@ describe('module', function () {
|
|||||||
|
|
||||||
await spawn(`npm test --prefix ${pkgPath}`, [], {
|
await spawn(`npm test --prefix ${pkgPath}`, [], {
|
||||||
shell: true,
|
shell: true,
|
||||||
stdio: 'pipe'
|
stdio: 'pipe',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user