Comments (7)
If it helps, I did polyfill it this way
global.Response = class extends Response {
constructor(body: any, init: any) {
super(body === "" && init.status === 204 ? null : body, init);
}
};
from elysia-polyfills.
Hi 👋
thanks for reporting!
Can you send me a small code snippet to reproduce this issue, and the version number used for the following packages, pls:
elysia
@elysiajs/cors
@bogeychan/elysia-polyfills
from elysia-polyfills.
For sure :)
Here you go https://github.com/jean343/elysia-polyfills-3
from elysia-polyfills.
I pnmp patch
-ed a8a0b15 in over v0.6.3 since it hasn't been released yet
diff --git a/src/env/headers.ts b/src/env/headers.ts
index 819e6234b17ee890c0f82526f3e86dae73e8628c..013eec21d0a9fd791b8dc34a83595344dc523825 100644
--- a/src/env/headers.ts
+++ b/src/env/headers.ts
@@ -27,6 +27,10 @@ globalThis.Request = class Request extends globalThis.Request {
};
globalThis.Response = class Response extends globalThis.Response {
+ constructor(body?: Bun.BodyInit | null, init?: Bun.ResponseInit) {
+ super(init?.status === 204 ? null : body, init);
+ }
+
// @ts-expect-error
get headers() {
return new globalThis.Headers(
but I'm still getting the same error, at least on aws lambda's node 20.x
Judging by the error message, the issue might not be that there's a body included, but with trying to make a 204 response at all, which is weird (or alternatively the error message is wrong/dumb/unhelpful, which wouldn't be the first time with node)
from elysia-polyfills.
Nevermind it works, for some reason the patch just didn't get bundled into the lambda bundle, sorry for the misinfo
from elysia-polyfills.
Should be fixed with 0.6.4
. Let me know if the issue persists
from elysia-polyfills.
I confirm that the fix works, thank you.
from elysia-polyfills.
Related Issues (6)
- CommonJS support HOT 3
- TypeError: this.server.reload is not a function HOT 1
- `response.headers.toJSON is not a function` when trying to return `new Response("foo")` with serverTIming plugin enabled HOT 3
- When using `Response.json()`, server returns with "response.headers.toJSON is not a function"
- Response headers not being set HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elysia-polyfills.