@server/next 0.40.1 → 0.40.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +6 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -869,6 +869,12 @@ var Reply = class {
|
|
|
869
869
|
return new Response(null, { status: status2, headers: headers2 });
|
|
870
870
|
}
|
|
871
871
|
if (body === null) body = "";
|
|
872
|
+
if (typeof body === "function") body = body();
|
|
873
|
+
if (typeof body?.then === "function") {
|
|
874
|
+
throw new Error(
|
|
875
|
+
"send() received a promise, likely an async component. Await it first, or return it from the route, which resolves it for you."
|
|
876
|
+
);
|
|
877
|
+
}
|
|
872
878
|
if (typeof body === "string") {
|
|
873
879
|
if (!headers2.get("content-type")) {
|
|
874
880
|
headers2.set("content-type", isHtml(body) ? mimes_default.html : mimes_default.text);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@server/next",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.2",
|
|
4
4
|
"description": "A fully-fledged web server with routing, file uploads, sessions, static files, schema validation, websockets, testing, etc.",
|
|
5
5
|
"homepage": "https://server-js.com/",
|
|
6
6
|
"repository": "github:franciscop/server-next",
|