Effect CommunityEC
Effect Community2y ago
1 reply
nickrttn

Inconsistent Header Behavior in `HttpServer.response.stream` Method

Not sure this is expected behavior or a bug, but this first option will cause the Content-Type header to be set to application/octet-stream, which HttpServer.response.stream applies internally.

const headers = new Headers([['Content-Type', 'text/event-stream']]); // using the native Headers constructor here
const res = HttpServer.response.stream(myStream).pipe(HttpServer.response.setHeaders(headers))


While this second option applies the wanted header correctly:

const headers = HttpServer.headers.fromInput({ 'Content-Type': 'text/event-stream' });
const res = HttpServer.response.stream(myStream, { headers: headers })


I would expect both to work.
Was this page helpful?