bogeychan / elysia-polyfills

Collection of experimental Elysia.js polyfills
https://npmjs.com/package/@bogeychan/elysia-polyfills
MIT License
48 stars 2 forks source link

Response headers not being set #6

Open MAST1999 opened 5 months ago

MAST1999 commented 5 months ago

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 commented 5 months ago

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');