node-mocks-http icon indicating copy to clipboard operation
node-mocks-http copied to clipboard

No way to get data written to response

Open yepitschunked opened this issue 1 year ago • 1 comments

I have some code which both writes to the response directly (using res.write) and also pipes some data to the response (using otherStream.pipe(res). The problem is that for some reason this library keeps track of Buffers and strings separately:

https://github.com/eugef/node-mocks-http/blob/5ab3de26a80bdbab04a7161a23a3df7bbaacbd53/lib/mockResponse.js#L351-L366

As a result, there's no way to piece back together the data that was written. _getBuffer/_getChunks sends *only *the Buffers that were written and not the string content, and vice versa. There's no way to reconstruct the original order either, since Buffers and string writes could've been interleaved.

yepitschunked avatar Jun 28 '24 22:06 yepitschunked

Stale issue message

github-actions[bot] avatar Aug 28 '24 01:08 github-actions[bot]

Stale issue message

github-actions[bot] avatar Oct 28 '24 01:10 github-actions[bot]