mirror of
https://github.com/denoland/deno.git
synced 2024-12-01 16:51:13 -05:00
perf(http): avoid checking promise every request (#14079)
This commit is contained in:
parent
c7aecc1299
commit
04d8ab9839
1 changed files with 1 additions and 5 deletions
|
@ -39,7 +39,6 @@
|
||||||
ArrayPrototypeSome,
|
ArrayPrototypeSome,
|
||||||
Error,
|
Error,
|
||||||
ObjectPrototypeIsPrototypeOf,
|
ObjectPrototypeIsPrototypeOf,
|
||||||
PromisePrototype,
|
|
||||||
Set,
|
Set,
|
||||||
SetPrototypeAdd,
|
SetPrototypeAdd,
|
||||||
SetPrototypeDelete,
|
SetPrototypeDelete,
|
||||||
|
@ -183,10 +182,7 @@
|
||||||
) {
|
) {
|
||||||
return async function respondWith(resp) {
|
return async function respondWith(resp) {
|
||||||
try {
|
try {
|
||||||
if (ObjectPrototypeIsPrototypeOf(PromisePrototype, resp)) {
|
resp = await resp;
|
||||||
resp = await resp;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(ObjectPrototypeIsPrototypeOf(ResponsePrototype, resp))) {
|
if (!(ObjectPrototypeIsPrototypeOf(ResponsePrototype, resp))) {
|
||||||
throw new TypeError(
|
throw new TypeError(
|
||||||
"First argument to respondWith must be a Response or a promise resolving to a Response.",
|
"First argument to respondWith must be a Response or a promise resolving to a Response.",
|
||||||
|
|
Loading…
Reference in a new issue