diff options
Diffstat (limited to 'ext/fetch/22_http_client.js')
-rw-r--r-- | ext/fetch/22_http_client.js | 17 |
1 files changed, 13 insertions, 4 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; |