-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
reverting createRemixHeaders to previous fix for handling multiple cookies #9664
reverting createRemixHeaders to previous fix for handling multiple cookies #9664
Conversation
🦋 Changeset detectedLatest commit: bf8fd7b The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 packages
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 |
Hi @Courey, Welcome, and thank you for contributing to Remix! Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once. You may review the CLA and sign it by adding your name to contributors.yml. Once the CLA is signed, the If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at hello@remix.run. Thanks! - The Remix team |
Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳 |
Do you want to take a stab at a unit test to prevent a regression like this in the future? |
Working on it now! |
The challenge I am having is that this test should have covered it. But I think that it's because the issue arises when using |
ah ok I don't think I realized this was only an issue when using web-fetch. Let me play around with a way to try to test this with both fetch implementations. In the meantime - would you mind rebasing this and pointing it to the |
Since export function createRemixHeaders(
requestHeaders: APIGatewayProxyEventHeaders,
requestCookies?: string[],
_Headers?: typeof Headers
): Headers {
// `_Headers` should only be used for unit testing purposes so we can unit test
// the different behaviors of the @remix-run/web-fetch `Headers` implementation
// and the node/undici implementation. See:
// https://github.com/remix-run/remix/issues/9657
let HeadersImpl = _Headers || Headers;
let headers = new HeadersImpl();
for (let [header, value] of Object.entries(requestHeaders)) {
if (value) {
headers.append(header, value);
}
}
if (requestCookies) {
// Do the semi-colon joining manually to avoid differences between Remix
// and node/undici `Headers` implementations
headers.append("Cookie", requestCookies.join("; "));
}
return headers;
} Then to test we can add a test for the import { Headers as RemixHeaders } from "@remix-run/web-fetch";
...
it("handles multiple request cookies when using @remix-run/web-fetch", () => {
let headers = createRemixHeaders(
{},
["__session=some_value", "__other=some_other_value"],
RemixHeaders
);
expect(headers.get("cookie")).toEqual(
"__session=some_value; __other=some_other_value"
);
}); We'll just need to install |
f207983
to
1b38cec
Compare
oh - yeah for the test I would just |
Looking good! Could you add a changeset as well so we can get this merged? Just run |
I just realized that I didn't add it to the package.json in architect! |
061a5db
to
bfb8e09
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
Closes: #9657
Testing Strategy:
I ran this locally and compared the output. This was also a re-introduced bug so this change is just going back to how it was a couple of months ago. It was introduced here and that is the change I am reverting.