Prerequisites
🚀 Feature Proposal
Add options to inject() to send HTTP/2 requests instead of HTTP/1.1. My proposal would be app.inject({ http2: true })... or app.inject({ httpVersion: 2 })... but automatic detection could work too.
Motivation
When I add http2: true to Fastify options, all requests made with inject() receive 505 status code. For secure servers, adding https: { allowHttp1: true } works, but
- the user may not want to allow HTTP/1.1;
- the server may behave differently depending on the protocol version and it's desired to test HTTP/2 in particular.
As a workaround for 1, you could have https: { allowHttp1: process.env.JEST_WORKER_ID !== undefined }, but I don't like server code knowing about tests like that.
And of course, if the server wants to use H2C, there's no allowHttp1 option.
Example
No response
Prerequisites
🚀 Feature Proposal
Add options to
inject()to send HTTP/2 requests instead of HTTP/1.1. My proposal would beapp.inject({ http2: true })...orapp.inject({ httpVersion: 2 })...but automatic detection could work too.Motivation
When I add
http2: trueto Fastify options, all requests made withinject()receive 505 status code. For secure servers, addinghttps: { allowHttp1: true }works, butAs a workaround for 1, you could have
https: { allowHttp1: process.env.JEST_WORKER_ID !== undefined }, but I don't like server code knowing about tests like that.And of course, if the server wants to use H2C, there's no
allowHttp1option.Example
No response