mirror of
https://github.com/denoland/deno.git
synced 2024-11-22 04:51:22 +00:00
perf(http): avoid checking promise every request (#14079)
This commit is contained in:
parent
c3f306d778
commit
5c9844e5f7
@ -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.",
|
||||
|
Loading…
Reference in New Issue
Block a user