1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-30 16:40:57 -05:00

perf(http): avoid checking promise every request (#14079)

This commit is contained in:
Divy Srivastava 2022-03-23 07:23:59 +05:30 committed by Kitson Kelly
parent c7aecc1299
commit 04d8ab9839

View file

@ -39,7 +39,6 @@
ArrayPrototypeSome,
Error,
ObjectPrototypeIsPrototypeOf,
PromisePrototype,
Set,
SetPrototypeAdd,
SetPrototypeDelete,
@ -183,10 +182,7 @@
) {
return async function respondWith(resp) {
try {
if (ObjectPrototypeIsPrototypeOf(PromisePrototype, resp)) {
resp = await resp;
}
resp = await resp;
if (!(ObjectPrototypeIsPrototypeOf(ResponsePrototype, resp))) {
throw new TypeError(
"First argument to respondWith must be a Response or a promise resolving to a Response.",