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

Response headers not being set #6

Open
MAST1999 opened this issue May 9, 2024 · 1 comment · May be fixed by #7
Open

Response headers not being set #6

MAST1999 opened this issue May 9, 2024 · 1 comment · May be fixed by #7

Comments

@MAST1999
Copy link

MAST1999 commented May 9, 2024

I'm using node 20.13.0 and I noticed that CORS was not working.

Looking it to it, I found that when trying to set headers on the Response object, it wouldn't work.

const res = new Response();
log.info([...res.headers.entries()], 'Test Headers');
res.headers.append('x-hello', 'world');
log.info([...res.headers.entries()], 'Test Headers 2');

This will print empty for the headers.

I'll try to see if I can update the polyfill to address this issue.

@MAST1999
Copy link
Author

MAST1999 commented May 9, 2024

But if you try with just Header it works correctly.

const hd = new Headers();
log.info([...hd.entries()], 'Test Headers');
hd.append('x-hello', 'world');
log.info([...hd.entries()], 'Test Headers 2');

MAST1999 added a commit to MAST1999/elysia-polyfills that referenced this issue May 9, 2024
…nted to add a header it would create a new header object and then discard it when we tried to later add something to it.

It would also return a new header everywhere because calling `request.header` would construct a new one.
@MAST1999 MAST1999 linked a pull request May 9, 2024 that will close this issue
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 a pull request may close this issue.

1 participant