-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow to httpClient use HTTP2 first (#5332)
base on node-modules/urllib#516 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced the ability to enable HTTP/2 support through the `allowH2` property when using the next-generation HTTP client. - **Bug Fixes** - Enhanced clarity and accuracy of comments for HTTP client configuration properties. - **Improvements** - Updated `urllib-next` dependency to version `^3.26.0` for better performance and stability. - Added tests to verify HTTP/2 functionality and custom HTTP client behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
- Loading branch information
Showing
8 changed files
with
74 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict'; | ||
|
||
const assert = require('assert'); | ||
|
||
module.exports = app => { | ||
class CustomHttpClient extends app.HttpClientNext { | ||
request(url, opt) { | ||
return new Promise(resolve => { | ||
assert(/^http/.test(url), 'url should start with http, but got ' + url); | ||
resolve(); | ||
}).then(() => { | ||
return super.request(url, opt); | ||
}); | ||
} | ||
|
||
curl(url, opt) { | ||
return this.request(url, opt); | ||
} | ||
} | ||
app.HttpClientNext = CustomHttpClient; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
exports.httpclient = { | ||
useHttpClientNext: true, | ||
allowH2: true, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name": "httpclient-overwrite" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters