Open cescoffier opened 3 years ago
/cc @FroMage, @geoand, @stuartwdouglas
I would say just end the response :)
I dunno, including a json error in the middle of an array is probably Horribly Wrong™…
We can't even put stuff in a tailer HTTP header because you have to declare them in advance, and only in CHUNK.
I can't find any obvious result online about how to handle this.
You can't include a JSON error in the middle of a response, that would be really wrong.
IMHO the best thing to do would be to just end the response so the resulting JSON is invalid.
We need to discuss the behavior when the streamed Multi emits a failure.
Imagine something like:
Basically, a failure happening during the streaming. We cannot set the status to 500, as the headers have already been written (BTW, if the failure happens before having sent any item, it should be the case).
What should be the outcome in this case? Should we encode the failure in JSON followed by ] and let the client handle the failure? Should we just end the response abruptly (no ending ])?