-
Notifications
You must be signed in to change notification settings - Fork 639
New issue
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
ProtocolError: malformed MIME header initial line #40
Comments
Could you post the raw response that triggers this error? |
|
Sorry, but can you also include the headers and request line along with the request body (and especially any whitespace or CRLF characters between them)? I want to investigate where actually did the |
Actually, have you sent the request correctly? Because it seems as if it is treating |
Here's the full request:
Here's the full error:
Seems to be responding correctly but still failing. |
I managed to reproduce this issue, and it turns out this problem arises if you try to respond to request without reading its body.
import * as deno from "deno";
import { serve } from "./http.ts";
const addr = deno.args[1] || "127.0.0.1:4500";
const server = serve(addr);
const body = new TextEncoder().encode("Hello World");
async function main(): Promise<void> {
for await (const request of server) {
await request.body() // adding this line prevent ProtocolError
await request.respond({ status: 200, body });
}
}
main(); I guess a check is needed in |
I believe this was resolved in #49, can we close this now? |
I'm sending over a
POST
request and I think it's confusing the body for the header.ProtocolError: malformed MIME header initial line: "query": "{ hello }",
The text was updated successfully, but these errors were encountered: