Skip to content
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

Closed
wants to merge 2 commits into from
Closed

[WIP] HTTP2 support #832

wants to merge 2 commits into from

Conversation

szmarczak
Copy link
Collaborator

@szmarczak szmarczak commented Jul 14, 2019

Fixes #167

Checklist

  • I have read the documentation.
  • I have included a pull request description of my changes.
  • I have included some tests.
  • If it's a new feature, I have included documentation updates.

readme.md Outdated Show resolved Hide resolved
readme.md Outdated Show resolved Hide resolved
readme.md Outdated Show resolved Hide resolved
source/request-as-event-emitter.ts Outdated Show resolved Hide resolved
test/https.ts Outdated Show resolved Hide resolved
readme.md Show resolved Hide resolved
readme.md Outdated Show resolved Hide resolved
@szmarczak
Copy link
Collaborator Author

@sindresorhus Maybe let's make all the tests use a HTTP2 server instead of HTTP1? That way we would be sure that http2-wrapper works as expected.

@szmarczak szmarczak changed the title HTTP2 support [WIP] HTTP2 support Nov 30, 2019
@sindresorhus
Copy link
Owner

Maybe let's make all the tests use a HTTP2 server instead of HTTP1? That way we would be sure that http2-wrapper works as expected.

Ideally, we would run all tests on both a HTTP1 and HTTP2 server to ensure everything works in both modes.

@szmarczak
Copy link
Collaborator Author

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>`
Copy link
Collaborator Author

@szmarczak szmarczak Dec 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It complains that request is unknown I have typed it badly


// @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) => {
Copy link
Collaborator Author

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>) => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Promisable -> ClientRequest | Promise<ClientRequest>

@sindresorhus
Copy link
Owner

So... Use an environment variable? And then run AVA twice?

Yeah

@szmarczak
Copy link
Collaborator Author

Closing in favor of #1051

@szmarczak szmarczak closed this Feb 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HTTP2 support
2 participants