mirror of
https://github.com/Kong/insomnia.git
synced 2026-11-05 04:23:55 -05:00
[INS-3885](https://konghq.atlassian.net/browse/INS-3885) Fixes #10492 ## Problem Setting `Accept: text/event-stream` on a request whose active response is a plain HTTP response made the response pane read that HTTP body out of `response.bodyPath` as if it were the NDJSON event log of a stream. The parsed objects have no `_id`, so the events table's row key was `undefined` and react-aria threw `Could not determine key for item`; the pane's error boundary replaced the whole response pane with `Render Failure: ...` (plus the "Application Error" modal). Repro (verified in the smoke harness): send a request that returns **compact single-line JSON** (`GET http://localhost:4010/pets/1` in the smoke echo server), then add `Accept: text/event-stream` to it. A pretty-printed body does *not* reproduce it — per-line `JSON.parse` fails in the main process first, the events list stays empty and the pane looks fine. A streamed Event Stream response writes its NDJSON event log into `bodyPath`, but the ordinary HTTP send path stores a raw body in that same field. So what an event is has to be decided by the **content** — not by the request's Accept header (that only expresses the intent to stream) and not by a stored flag on the response (which would need a startup backfill and could never be removed). ## Fix `curl.event.findMany` keeps only lines that parse to an event — an object carrying the fields every curl event has (`_id`, `requestId`, `type`) — and skips everything else: - a JSON or HTML response body yields no events instead of keyless rows, so the table can no longer blow up; - a line still being appended while a stream is open is skipped instead of rejecting the whole read; - event logs written by older versions keep working, since the rule is about the data, not about when it was written. No model, loader or pane changes: the request header keeps deciding which pane to show.