bogeychan / elysia-polyfills

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

fix(#6): Headers now working correctly. #7

Open MAST1999 opened 5 months ago

MAST1999 commented 5 months ago

Headers are should be persisted. Before each time we wanted 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.

I'm not sure if this breaks anything else, but from my testing on my app it seems to be working fine.

Fixes: #6

KaydaFox commented 5 months ago

Just as a random question, do you think this would also fix #5?

MAST1999 commented 5 months ago

Just as a random question, do you think this would also fix #5?

Hmm, depends on how the Response.json is implemented.

MAST1999 commented 5 months ago

@KaydaFox you can copy the changes I've made to your app and see if it fixes it.

I also recommend replacing #headers with headers to see if it fixes it.