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

fix: use headers.entries() instead of headers.raw() #7150

Conversation

MichaelDeBoey
Copy link
Member

Closes #4354

@changeset-bot
Copy link

changeset-bot bot commented Aug 14, 2023

🦋 Changeset detected

Latest commit: 0689d14

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

This PR includes changesets to release 16 packages
Name Type
@remix-run/architect Patch
@remix-run/express Patch
@remix-run/serve Patch
@remix-run/dev Patch
create-remix Patch
remix Patch
@remix-run/cloudflare Patch
@remix-run/cloudflare-pages Patch
@remix-run/cloudflare-workers Patch
@remix-run/css-bundle Patch
@remix-run/deno Patch
@remix-run/eslint-config Patch
@remix-run/node Patch
@remix-run/react Patch
@remix-run/server-runtime Patch
@remix-run/testing 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

@MichaelDeBoey MichaelDeBoey added the v2 Issues related to v2 apis label Aug 14, 2023
@brophdawg11
Copy link
Contributor

@mjackson the move to raw came from #241 - do you have context on whether it's safe to switch back?

@MichaelDeBoey MichaelDeBoey force-pushed the use-headers-entries-instead-of-headers-raw branch from e66c63f to 1f1862d Compare August 14, 2023 19:53
Comment on lines 121 to 124
for (let [key, values] of nodeResponse.headers.entries()) {
for (let value of values) {
res.append(key, value);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This breaks for me since entries returns strings, not arrays in values like raw did so this then iterates over the characters in the values string.

I think the original bug actually boils down to a bug in the node-fetch entries implementation (which we inherited into the Remix fork) - I pushed a potential fix here: remix-run/web-std-io#39

If we were to merge that fix, then I think this would become:

Suggested change
for (let [key, values] of nodeResponse.headers.entries()) {
for (let value of values) {
res.append(key, value);
}
for (let [key, value] of nodeResponse.headers.entries()) {
res.append(key, value);

Copy link
Contributor

@brophdawg11 brophdawg11 left a comment

Choose a reason for hiding this comment

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

Requesting changes just to keep this on hold until we can get remix-run/web-std-io#39 merged.

@MichaelDeBoey MichaelDeBoey force-pushed the use-headers-entries-instead-of-headers-raw branch from 1ce1e9b to 0689d14 Compare August 16, 2023 20:07
@MichaelDeBoey MichaelDeBoey merged commit 465a5c9 into remix-run:dev Aug 16, 2023
9 checks passed
@MichaelDeBoey MichaelDeBoey deleted the use-headers-entries-instead-of-headers-raw branch August 16, 2023 20:35
@github-actions
Copy link
Contributor

🤖 Hello there,

We just published version v0.0.0-nightly-1d3d86e-20230817 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

@github-actions
Copy link
Contributor

🤖 Hello there,

We just published version 2.0.0-pre.0 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed v2 Issues related to v2 apis
Projects
No open projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

3 participants