Fix websocket is broken because of middleware

This commit is contained in:
2023-06-26 17:57:38 +08:00
parent f5c45066e0
commit 5108526b2f

View File

@@ -14,6 +14,7 @@ export async function handler(req: Request, ctx: MiddlewareHandlerContext) {
}
return new Response(null, { status: 204, headers });
} else {
if (res.status === 101) return res;
const headers = new Headers(res.headers);
const origin = req.headers.get("origin");
if (origin) {