Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(remix-react): fix content-type on proxied action request #4995

Merged
merged 3 commits into from
Jan 4, 2023

Conversation

brophdawg11
Copy link
Contributor

Closes #4967

@changeset-bot
Copy link

changeset-bot bot commented Jan 3, 2023

🦋 Changeset detected

Latest commit: e8e8a15

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 17 packages
Name Type
@remix-run/react Patch
@remix-run/testing Patch
create-remix Patch
remix Patch
@remix-run/architect Patch
@remix-run/cloudflare Patch
@remix-run/cloudflare-pages Patch
@remix-run/cloudflare-workers Patch
@remix-run/deno Patch
@remix-run/dev Patch
@remix-run/eslint-config Patch
@remix-run/express Patch
@remix-run/netlify Patch
@remix-run/node Patch
@remix-run/serve Patch
@remix-run/server-runtime Patch
@remix-run/vercel Patch

Not sure what this means? Click here to learn what changesets are.

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

@@ -36,16 +36,18 @@ export async function fetchData(
let url = new URL(request.url);
url.searchParams.set("_data", routeId);

let init: RequestInit | undefined;
let init: RequestInit = { signal: request.signal };
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can always start with the signal now

// paragraph of https://httpwg.org/specs/rfc9110.html#field.content-type
contentType && /\bapplication\/x-www-form-urlencoded\b/.test(contentType)
? new URLSearchParams(await request.text())
: await request.formData();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conditionally set URLSearchParams or FormData as the body and let Content-Type inherit automatically

@MichaelDeBoey MichaelDeBoey changed the title Fix content type on proxied action request fix(remix-react): fix content-type on proxied action request Jan 4, 2023
@brophdawg11 brophdawg11 merged commit 56cea66 into release-next Jan 4, 2023
@brophdawg11 brophdawg11 deleted the brophdawg11/fix-content-type branch January 4, 2023 16:56
brophdawg11 added a commit that referenced this pull request Jan 4, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

request.text() fails to produce parseable contents in 1.10-pre5
4 participants