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
From solidjs/solid-start#1426
I get Content-Type: text/html if i return a response in a middleware with a async body.
Content-Type: text/html
import { Response } from 'undici'; return new Response(bodyStream.iterator(), { status: 200, statusText: 'OK', headers: {'content-type': 'application/json'}, });
If the bodyStream is not async it does work.
import { Response } from 'undici'; const streamToBuffer = async (stream: Stream): Promise<Buffer> => { return new Promise<Buffer>((resolve, reject) => { const list: Array<Uint8Array> = []; stream.on('data', (chunk) => list.push(chunk)); stream.on('end', () => resolve(Buffer.concat(list))); stream.on('error', (error) => reject(error)); }); }; return new Response(await streamToBuffer(bodyStream), { status: 200, statusText: 'OK', headers: {'content-type': 'application/json'}, });
I expect that the content-type passed as a headers is maintained in async and sync bodies on response.
Steps:
No response
System: OS: Fedora 39 CPU: x86_64 Binaries: Node: 20.11.1 (/run/user/1000/fnm_multishells/128003_1711479810299/bin/node) pnpm: 8.15.4 (/run/user/1000/fnm_multishells/128003_1711479810299/bin/pnpm) npmPackages: all of solid start + "undici": "^6.10.2" "undici-types": "^6.10.1"
This is the bridging code https://github.com/chubbyts/chubbyts-http-undici-bridge
The text was updated successfully, but these errors were encountered:
Any news on this?
Sorry, something went wrong.
No branches or pull requests
From solidjs/solid-start#1426
Current behavior 😯
I get
Content-Type: text/html
if i return a response in a middleware with a async body.If the bodyStream is not async it does work.
Expected behavior 🤔
I expect that the content-type passed as a headers is maintained in async and sync bodies on response.
Steps to reproduce 🕹
Steps:
Context 🔦
No response
Your environment 🌎
This is the bridging code https://github.com/chubbyts/chubbyts-http-undici-bridge
The text was updated successfully, but these errors were encountered: