Skip to content

Unit testing a HTTP handler that returns a stream of multiple files #2396

Answered by aldas
Megidd asked this question in Q&A
Discussion options

You must be logged in to vote

I have no idea how you can distinguish separate files written to stream with multireader. Multireader just concatenates reader outputs to single "stream" of bytes.

c.Stream is absolutely generic and it is up to you define rules to how to interpret its output.

You probably could hack something together with multipart. See this https://peter.bourgon.org/blog/2019/02/12/multipart-http-responses.html but this means that you need "special" handling of response at the client side also.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Megidd
Comment options

Answer selected by Megidd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants