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

Request body empty within the loader #3280

Closed
Leo843 opened this issue May 21, 2022 · 1 comment
Closed

Request body empty within the loader #3280

Leo843 opened this issue May 21, 2022 · 1 comment

Comments

@Leo843
Copy link

Leo843 commented May 21, 2022

What version of Remix are you using?

1.4.3

Steps to Reproduce

  • Create a new remix project
  • Create a test route that exports only a loader
import { json } from '@remix-run/node'
export const loader = async ({ request }) => {
  const body = await request.text()
  console.log(body)
  return json({ success: true }, 200)
}
  • Send a GET request with some content
    curl -X GET -d '{ "content":"something" }' http://localhost:3000/test

Expected Behavior

The content of the request { "content":"something" } should be printed in the console (server side).

Actual Behavior

An empty string is printed in the console (server side). Furthermore, the body property of the request object within the loader is null.

@MichaelDeBoey
Copy link
Member

This is expected behavior as GET/HEAD requests shouldn't have a body according to the spec

This was changed in #3207

@MichaelDeBoey MichaelDeBoey closed this as not planned Won't fix, can't repro, duplicate, stale May 21, 2022
@Leo843 Leo843 closed this as completed May 21, 2022
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

No branches or pull requests

2 participants