fix
This commit is contained in:
parent
6096b529c5
commit
2e847a7691
|
|
@ -7,6 +7,7 @@
|
|||
"@node-rs/argon2": "^1.5.2",
|
||||
"@paralleldrive/cuid2": "^2.2.2",
|
||||
"@parcel/watcher": "^2.4.1",
|
||||
"@types/bun": "^1.1.14",
|
||||
"@types/lodash.isequal": "^4.5.8",
|
||||
"@types/mime-types": "^2.1.4",
|
||||
"del": "^7.1.0",
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ declare global {
|
|||
opt?: {
|
||||
rewrite?: (arg: {
|
||||
body: Bun.BodyInit;
|
||||
headers: Response["headers"];
|
||||
headers: Headers | any;
|
||||
}) => Bun.BodyInit;
|
||||
}
|
||||
) => Promise<Response>;
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ export interface PrasiServer extends Record<string, any> {
|
|||
opt?: {
|
||||
rewrite?: (arg: {
|
||||
body: Bun.BodyInit;
|
||||
headers: Response["headers"];
|
||||
headers: Headers | any;
|
||||
}) => Bun.BodyInit;
|
||||
}
|
||||
) => Promise<Response>;
|
||||
|
|
@ -190,5 +190,6 @@ export interface PrasiServer extends Record<string, any> {
|
|||
const glb = global as unknown as {
|
||||
_server: ReturnType<typeof serverMain>;
|
||||
};
|
||||
|
||||
glb._server = serverMain();
|
||||
export const server = glb._server;
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ declare global {
|
|||
handle: (req: Request, opt?: {
|
||||
rewrite?: (arg: {
|
||||
body: Bun.BodyInit;
|
||||
headers: Response["headers"];
|
||||
headers: Headers | any;
|
||||
}) => Bun.BodyInit;
|
||||
}) => Promise<Response>;
|
||||
serveStatic?: any;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ export const createServer = async () => {
|
|||
opt?: {
|
||||
rewrite?: (arg: {
|
||||
body: Bun.BodyInit;
|
||||
headers: Response["headers"];
|
||||
headers: Headers | any;
|
||||
}) => Bun.BodyInit;
|
||||
}
|
||||
) => {
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ export const serveStatic = {
|
|||
opt?: {
|
||||
rewrite?: (arg: {
|
||||
body: Bun.BodyInit;
|
||||
headers: Response["headers"];
|
||||
headers: Headers | any;
|
||||
}) => Bun.BodyInit;
|
||||
}
|
||||
) => {
|
||||
|
|
@ -109,7 +109,7 @@ export const serveStatic = {
|
|||
opt?: {
|
||||
rewrite?: (arg: {
|
||||
body: Bun.BodyInit;
|
||||
headers: Response["headers"];
|
||||
headers: Headers | any;
|
||||
}) => Bun.BodyInit;
|
||||
}
|
||||
) {
|
||||
|
|
@ -193,7 +193,7 @@ const rewriteResponse = (
|
|||
opt?: {
|
||||
rewrite?: (arg: {
|
||||
body: Bun.BodyInit;
|
||||
headers: Response["headers"];
|
||||
headers: Headers | any;
|
||||
}) => Bun.BodyInit;
|
||||
};
|
||||
}
|
||||
|
|
@ -202,11 +202,11 @@ const rewriteResponse = (
|
|||
arg.headers instanceof Headers ? arg.headers : new Headers(arg.headers);
|
||||
|
||||
if (arg.opt?.rewrite) {
|
||||
return new Response(arg.opt.rewrite({ body: body, headers }), {
|
||||
return new Response(arg.opt.rewrite({ body: body, headers }) as any, {
|
||||
headers,
|
||||
status: arg.status,
|
||||
});
|
||||
}
|
||||
|
||||
return new Response(body, { headers, status: arg.status });
|
||||
return new Response(body as any, { headers, status: arg.status });
|
||||
};
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ export const g = global as unknown as {
|
|||
opt?: {
|
||||
rewrite?: (arg: {
|
||||
body: Bun.BodyInit;
|
||||
headers: Response["headers"];
|
||||
headers: Headers | any;
|
||||
}) => Bun.BodyInit;
|
||||
}
|
||||
) => Promise<Response>;
|
||||
|
|
|
|||
Loading…
Reference in New Issue