zed icon indicating copy to clipboard operation
zed copied to clipboard

remove GET /events content negotiation

Open nwt opened this issue 2 years ago • 0 comments

GET /events provides server-sent events. It currently performs server-driven content negotiation, and the negotiated content type is used to encode "data" values in the response body. There are a couple of problems with this as currently implemented.

  1. A request header of "Accept: text/event-stream" is allowed by the server-sent events specification but causes content negotiation to fail.
  2. The specification requires a UTF-8 stream in the response body, but a binary negotiated content type (e.g., Parquet or ZNG) can produce non-UTF-8 "data" values.

The desktop app is this route's only known user, and it always requests JSON, so a simple way to fix these problems is to remove the content negotiation, ignore the Accept request header entirely, and always encode "data" values as JSON.

nwt avatar Jul 04 '22 16:07 nwt