fix: prevent crashing the rest process (#2159)

* fix: prevent crashing the rest process

There where instances where some requests crashed the rest process. I found that checking for a body pretty much fixed it. 
There is probably a better way to do this, please improve this if you have an idea :)

* chore: use undefined instead of empty string

Co-authored-by: LTS20050703 <87189679+lts20050703@users.noreply.github.com>

* chore: use ternary operator

Co-authored-by: LTS20050703 <87189679+lts20050703@users.noreply.github.com>
This commit is contained in:
viinz
2022-04-10 19:23:08 +02:00
committed by GitHub
parent 88f7529dc4
commit b24893541b

View File

@@ -42,7 +42,7 @@ async function handleRequest(conn: Deno.Conn) {
);
}
const json = (await requestEvent.request.json());
const json = requestEvent.request.body ? (await requestEvent.request.json()) : undefined;
try {
const result = await rest.runMethod(