summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/http.ts
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2023-12-26 18:30:26 -0700
committerGitHub <noreply@github.com>2023-12-27 02:30:26 +0100
commit0efe438f7c191d8504355e03b27fe7e3055c9387 (patch)
treeb96fe9a897eb6941c87a95a04520662d26c02fbe /ext/node/polyfills/http.ts
parente33c5eb704c22fad69876e87d9b852a4e5072a7a (diff)
perf: remove opAsync (#21690)
`opAsync` requires a lookup by name on each async call. This is a mechanical translation of all opAsync calls to ensureFastOps. The `opAsync` API on Deno.core will be removed at a later time.
Diffstat (limited to 'ext/node/polyfills/http.ts')
-rw-r--r--ext/node/polyfills/http.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/ext/node/polyfills/http.ts b/ext/node/polyfills/http.ts
index e49f71702..8b7bcc21f 100644
--- a/ext/node/polyfills/http.ts
+++ b/ext/node/polyfills/http.ts
@@ -60,6 +60,10 @@ import { timerId } from "ext:deno_web/03_abort_signal.js";
import { clearTimeout as webClearTimeout } from "ext:deno_web/02_timers.js";
import { resourceForReadableStream } from "ext:deno_web/06_streams.js";
import { TcpConn } from "ext:deno_net/01_net.js";
+const {
+ op_fetch_response_upgrade,
+ op_fetch_send,
+} = core.ensureFastOps();
enum STATUS_CODES {
/** RFC 7231, 6.2.1 */
@@ -656,7 +660,7 @@ class ClientRequest extends OutgoingMessage {
(async () => {
try {
- const res = await core.opAsync("op_fetch_send", this._req.requestRid);
+ const res = await op_fetch_send(this._req.requestRid);
try {
cb?.();
} catch (_) {
@@ -710,8 +714,7 @@ class ClientRequest extends OutgoingMessage {
throw new Error("not implemented CONNECT");
}
- const upgradeRid = await core.opAsync(
- "op_fetch_response_upgrade",
+ const upgradeRid = await op_fetch_response_upgrade(
res.responseRid,
);
assert(typeof res.remoteAddrIp !== "undefined");