last fixes hopefully

This commit is contained in:
TopchetoEU 2023-07-01 02:00:59 +03:00
parent 0dbfd14313
commit 1d3b31532a
3 changed files with 4 additions and 5 deletions

View File

@ -23,7 +23,7 @@ if (Deno.args[0] === "prod") {
if (!r) req.respondWith(new Response("nope :/", {
status: 404
}));
else req.respondWith(r.toFetchResponse());
else await req.respondWith(r.toFetchResponse());
}
})().catch(console.error);
}

View File

@ -107,7 +107,6 @@ export default class Router {
for await (const conn of server) {
(async () => {
for await (const req of Deno.serveHttp(conn)) {
console.log(req.request.url);
const r = await this.handle(RestRequest.fromMessage(req));
if (r) req.respondWith(r.toFetchResponse());
}

View File

@ -12,11 +12,11 @@ export default function staticHandler(path: string): Handler {
await stream.read(new Uint8Array(1));
await stream.seek(0, Deno.SeekMode.Start);
if (i >= 0) res.contentType(realPath.substring(i + 1));
return res;
if (i >= 0) return res.contentType(realPath.substring(i + 1));
else return res;
}
catch (e) {
console.log(e);
console.error(e);
return undefined;
}
}