formidable icon indicating copy to clipboard operation
formidable copied to clipboard

HTTP2 ClientHttp2Stream support

Open FStefanni opened this issue 2 years ago • 4 comments

Support plan

  • which support plan is this issue covered by? (e.g. Community, Sponsor, or Enterprise): Community
  • is this issue currently blocking your project? (yes/no): no
  • is this issue affecting a production system? (yes/no): no

Context

  • node version: 18.0.6
  • module (formidable) version: 3.2.4
  • environment (e.g. node, browser, native, OS): node
  • used with (i.e. popular names of modules): custom
  • any other relevant information:

What problem are you trying to solve?

Hi,

I am using formidable with Typescript. I have seen that the formidable.parse() method accepts http.IncomingMessage, which is fine for server side, and for HTTP1 client-side. But client-side with HTTP2, it should also accept http2.ClientHttp2Stream.

So the questions/issues are:

  1. Can formidable work with also http2.ClientHttp2Stream? I suppose so, but the Typescript compiler complains... (before putting a brutal unsafe cast I want to be sure)
  2. If not, it would be nice to also support this use case
  3. Types definitions should be updated accordingly (also if already supported)

Regards

EDIT

Just seen that also http2.Http2ServerRequest makes the Typescript compiler complain. So even HTTP2 seems not explicitly supported. So definitely supporting HTTP2 would be a useful feature.

Do you have a new or modified API suggestion to solve the problem?

If as I suppose, formidable already supports the HTTP2 client side, the problem fix is just a matter of updating the types definitions of formidable.parse() to accept also a http2.ClientHttp2Stream (http.IncomingMessage | http2.ClientHttp2Stream).

FStefanni avatar Oct 04 '22 13:10 FStefanni

Thanks

GrosSacASac avatar Oct 04 '22 13:10 GrosSacASac

Thank you

nagayev avatar Oct 04 '22 14:10 nagayev

@FStefanni I think it is supported too. We don't do much with the stream, we just get the headers - at least that's the very basic explanation of what Formidable is doing, haha. I guess it's the typings.

tunnckoCore avatar Dec 30 '22 14:12 tunnckoCore

Hi,

yes I also suppose (but I have not done a deep dive in the code) that its only a matter of typings. So updating the types definitions could suffice and fix this issue.

Regards

FStefanni avatar Jan 02 '23 07:01 FStefanni