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

[Miniflare 3] Allow GET requests with bodies in entry worker #677

Merged
merged 1 commit into from
Sep 6, 2023

Conversation

mrbbot
Copy link
Contributor

@mrbbot mrbbot commented Sep 6, 2023

Hey! 👋 Whilst prohibited by the Request API spec, GET requests are allowed to have bodies. If Content-Length or Transfer-Encoding are specified, workerd will give the request a (potentially empty) body. Passing a bodied-GET-request through to the new Request() constructor should throw, but workerd has special handling to allow this if a Request instance is passed.

Miniflare was previously decomposing the request before passing it back to the new Request() constructor, defeating this detection. This change ensures we always pass full Request instances to the new Request() constructor in the entry worker.

Closes cloudflare/workerd#1122

Whilst prohibited by the `Request` API spec, `GET` requests are
allowed to have bodies. If `Content-Length` or `Transfer-Encoding`
are specified, `workerd` will give the request a (potentially empty)
body. Passing a bodied-GET-request through to the `new Request()`
constructor should throw, but `workerd` has special handling to allow
this if a `Request` instance is passed.

Miniflare was previously decomposing the request before passing it
back to the `new Request()` constructor, defeating this detection.
This change ensures we always pass full `Request` instances to the
`new Request()` constructor in the entry worker.

Closes cloudflare/workerd#1122
@mrbbot mrbbot requested a review from a team September 6, 2023 17:29
@changeset-bot
Copy link

changeset-bot bot commented Sep 6, 2023

⚠️ No Changeset found

Latest commit: c771499

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@mrbbot mrbbot changed the title Allow GET requests with bodies in entry worker [Miniflare 3] Allow GET requests with bodies in entry worker Sep 6, 2023
@mrbbot mrbbot merged commit d1f1ef7 into tre Sep 6, 2023
@mrbbot mrbbot deleted the bcoll/tre-get-bodies branch September 6, 2023 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants