-
-
Notifications
You must be signed in to change notification settings - Fork 935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] HTTP2 support #832
[WIP] HTTP2 support #832
Conversation
@sindresorhus Maybe let's make all the tests use a HTTP2 server instead of HTTP1? That way we would be sure that |
Ideally, we would run all tests on both a HTTP1 and HTTP2 server to ensure everything works in both modes. |
So... Use an environment variable? And then run AVA twice? |
// @ts-ignore `cacheable-request` doesn't support async request function | ||
result.once = emitter.once.bind(emitter); | ||
|
||
// @ts-ignore This is a TS bug, because `result` is `Promise<http.ClientRequest>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It complains that I have typed it badlyrequest
is unknown
|
||
// @ts-ignore This is a TS bug, because `result` is `Promise<http.ClientRequest>` | ||
// eslint-disable-next-line promise/prefer-await-to-then | ||
result.then((request: http.ClientRequest) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return result.then(...);
@@ -218,12 +248,18 @@ export default (options: NormalizedOptions): RequestAsEventEmitter => { | |||
} | |||
}); | |||
|
|||
cacheRequest.once('request', handleRequest); | |||
cacheRequest.once('request', async (request: Promisable<http.ClientRequest>) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Promisable
-> ClientRequest | Promise<ClientRequest>
Yeah |
Closing in favor of #1051 |
Fixes #167
Checklist