Closed hbgl closed 1 year ago
Hi @hbgl, there are no plans to implement this feature.
So I'd like encourage you to create a PR wow add a missing functionality.
Hello @eugef, thanks for the reply. I will create a PR for this new feature once I am done. It will require Node version >= 10 because that is when async iterator support was added.
As an aside, I would not give up on properly extending from ReadableStream
(old PR) which already comes with async iterator support baked in among other things. One could even think about extending IncomingMessage
directly. In any case, it would probably be a breaking change.
We are currently supporting Node.js 14 and above, so you can safely use async iterators
We are currently supporting Node.js 14 and above, so you can safely use async iterators
I saw this line in the package.json https://github.com/eugef/node-mocks-http/blob/5d97424e1fc98cd2c4be768aea93deb73110a885/package.json#L40-L42
So I was unsure if adding async iterators would be a problem. Thanks for clearing that up.
Thanks for pointing out, I will fix it straight away
Node's
http.IncomingMessage
inherits fromstream.Readable
which implements the async iterator protocol in recent versions of Node. It would be appropriate for the mock to also have support for it. A use case would be converting anhttp.IncomingMessage
to a webRequest
:It would help me fix this issue in Astro: https://github.com/withastro/astro/issues/7525#issuecomment-1622597735