You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
HttpResponseStream doesn't work when ending the stream without a write #97
When using HttpResponseStream to set the status code and headers on a streaming response, I noticed that if I never call write on the stream, the custom status code and headers don't work.
Example repro:
exportconsthandler=awslambda.streamifyResponse(async(event,responseStream,context)=>{constmetadata={statusCode: 404,headers: {"Content-Type": "text/plain","X-Foo": "Bar"}};responseStream=awslambda.HttpResponseStream.from(responseStream,metadata);// This will cause a 502 with no custom response headers:responseStream.end("Not Found");// This will cause a 200 with no custom response headers:responseStream.end();});
I believe this is because HttpResponseStream relies on the onBeforeFirstWrite callback:
Activity
paya-cz commentedon Apr 26, 2024
Related to #95