Skip to content
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

When fetching with body from the request 'Content-Length' is missing. #522

Closed
notorca opened this issue Feb 25, 2023 · 0 comments · Fixed by #545
Closed

When fetching with body from the request 'Content-Length' is missing. #522

notorca opened this issue Feb 25, 2023 · 0 comments · Fixed by #545
Labels
behaviour mismatch Different behaviour to Workers runtime

Comments

@notorca
Copy link
Contributor

notorca commented Feb 25, 2023

Test script. Request sent to the http:https://127.0.0.1:8000/foo is chunked.

async fetch(
	request: Request,
	env: Env,
	ctx: ExecutionContext
): Promise<Response> {
	console.log(`Length: ${request.headers.get('Content-Length')}`)
	await fetch("http:https://127.0.0.1:8000/foo", { method: 'POST', body: request.body! })
	return new Response("Hello World!");
}
@mrbbot mrbbot added the behaviour mismatch Different behaviour to Workers runtime label Mar 21, 2023
mrbbot added a commit that referenced this issue Mar 23, 2023
Previously, using a `Request`/`Response` `body` in another `fetch`
request, without copying over headers would send the request with
`Transfer-Encoding: chunked`. The Workers runtime will remember the
`Content-Length` here, so we now attach it to the stream.
mrbbot added a commit that referenced this issue Mar 23, 2023
…#545)

Previously, using a `Request`/`Response` `body` in another `fetch`
request, without copying over headers would send the request with
`Transfer-Encoding: chunked`. The Workers runtime will remember the
`Content-Length` here, so we now attach it to the stream.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
behaviour mismatch Different behaviour to Workers runtime
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants