We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.1.25
Darwin 23.5.0 arm64 arm
set.headers['Content-Type'] = 'application/json'; return stream satisfies Promise<ReadableStream<string>>;
Received a response with:
Content-Type: application/json; charset=utf-8
Content-Type: application/json, text/event-stream; charset=utf-8
In the response body, I wish I could stream a string. The string is actually a JSON text (generated by my streaming stringify)
node_modules
bun.lockb
yes
The text was updated successfully, but these errors were encountered:
I would like to hear what scenario led you to return application/json with event stream data.
application/json
However, you can use mapResponse to override Elysia default response like this:
new Elysia() .get('/', () => {}, { mapResponse({ response }) { if (response instanceof ReadableStream) return new Response(response, { headers: { 'Content-Type': 'application/octet-stream' } }) } })
Sorry, something went wrong.
No branches or pull requests
What version of Elysia is running?
1.1.25
What platform is your computer?
Darwin 23.5.0 arm64 arm
What steps can reproduce the bug?
What is the expected behavior?
Received a response with:
Content-Type: application/json; charset=utf-8
What do you see instead?
Received a response with:
Content-Type: application/json, text/event-stream; charset=utf-8
Additional information
In the response body, I wish I could stream a string.
The string is actually a JSON text (generated by my streaming stringify)
Have you try removing the
node_modules
andbun.lockb
and try again yet?yes
The text was updated successfully, but these errors were encountered: