@server/next 0.44.0 → 0.44.1
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 +8 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -2232,12 +2232,18 @@ async function handleRequest(app, ctx) {
|
|
|
2232
2232
|
if (replaced) res = replaced;
|
|
2233
2233
|
}
|
|
2234
2234
|
if (res) ctx.options.log.request(ctx, res);
|
|
2235
|
+
if (res?.body && ctx.method === "head") {
|
|
2236
|
+
res.body.cancel().catch(() => {
|
|
2237
|
+
});
|
|
2238
|
+
res = new Response(null, { status: res.status, headers: res.headers });
|
|
2239
|
+
}
|
|
2235
2240
|
return res;
|
|
2236
2241
|
}
|
|
2237
2242
|
async function getResponse(app, ctx) {
|
|
2238
2243
|
try {
|
|
2239
2244
|
let matched = false;
|
|
2240
|
-
|
|
2245
|
+
const routes = ctx.method === "head" ? [...app.handlers.head, ...app.handlers.get] : app.handlers[ctx.method];
|
|
2246
|
+
for (const route of routes) {
|
|
2241
2247
|
const params = pathPattern(route.path, ctx.url.pathname || "/");
|
|
2242
2248
|
if (!params) continue;
|
|
2243
2249
|
matched = true;
|
|
@@ -2581,7 +2587,7 @@ function parseRange(header, size) {
|
|
|
2581
2587
|
var CACHE_CONTROL = "public, max-age=3600";
|
|
2582
2588
|
async function assets(ctx) {
|
|
2583
2589
|
if (!ctx.options.public) return;
|
|
2584
|
-
if (ctx.method !== "get") return;
|
|
2590
|
+
if (ctx.method !== "get" && ctx.method !== "head") return;
|
|
2585
2591
|
if (ctx.url.pathname === "/") return;
|
|
2586
2592
|
try {
|
|
2587
2593
|
const key = ctx.url.pathname.replace(/^\/+/, "");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@server/next",
|
|
3
|
-
"version": "0.44.
|
|
3
|
+
"version": "0.44.1",
|
|
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",
|