summaryrefslogtreecommitdiff
path: root/ext/fetch
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fetch')
-rw-r--r--ext/fetch/22_http_client.js17
-rw-r--r--ext/fetch/23_request.js6
2 files changed, 17 insertions, 6 deletions
diff --git a/ext/fetch/22_http_client.js b/ext/fetch/22_http_client.js
index bd838e663..c1ddbd7c4 100644
--- a/ext/fetch/22_http_client.js
+++ b/ext/fetch/22_http_client.js
@@ -10,11 +10,14 @@
/// <reference path="./lib.deno_fetch.d.ts" />
/// <reference lib="esnext" />
-import { core } from "ext:core/mod.js";
+import { core, primordials } from "ext:core/mod.js";
import { SymbolDispose } from "ext:deno_web/00_infra.js";
import { op_fetch_custom_client } from "ext:core/ops";
+const { internalRidSymbol } = core;
+const { ObjectDefineProperty } = primordials;
+
/**
* @param {Deno.CreateHttpClientOptions} options
* @returns {HttpClient}
@@ -29,19 +32,25 @@ function createHttpClient(options) {
}
class HttpClient {
+ #rid;
+
/**
* @param {number} rid
*/
constructor(rid) {
- this.rid = rid;
+ ObjectDefineProperty(this, internalRidSymbol, {
+ enumerable: false,
+ value: rid,
+ });
+ this.#rid = rid;
}
close() {
- core.close(this.rid);
+ core.close(this.#rid);
}
[SymbolDispose]() {
- core.tryClose(this.rid);
+ core.tryClose(this.#rid);
}
}
const HttpClientPrototype = HttpClient.prototype;
diff --git a/ext/fetch/23_request.js b/ext/fetch/23_request.js
index 8ca92ca72..542bcb8bb 100644
--- a/ext/fetch/23_request.js
+++ b/ext/fetch/23_request.js
@@ -9,7 +9,7 @@
/// <reference path="./lib.deno_fetch.d.ts" />
/// <reference lib="esnext" />
-import { primordials } from "ext:core/mod.js";
+import { core, primordials } from "ext:core/mod.js";
const {
ArrayPrototypeMap,
ArrayPrototypeSlice,
@@ -45,6 +45,8 @@ import {
import { HttpClientPrototype } from "ext:deno_fetch/22_http_client.js";
import * as abortSignal from "ext:deno_web/03_abort_signal.js";
+const { internalRidSymbol } = core;
+
const _request = Symbol("request");
const _headers = Symbol("headers");
const _getHeaders = Symbol("get headers");
@@ -355,7 +357,7 @@ class Request {
"Argument 2",
);
}
- request.clientRid = init.client?.rid ?? null;
+ request.clientRid = init.client?.[internalRidSymbol] ?? null;
}
// 28.