diff options
author | Asher Gomez <ashersaupingomez@gmail.com> | 2024-02-19 01:27:06 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-18 07:27:06 -0700 |
commit | 7abd72a80f0aafe071ad7d298b48e0da741cc9f3 (patch) | |
tree | f0791793f15667b18dc2644c242d0905190e27d1 /ext/fetch/22_http_client.js | |
parent | 3a243c827238b93c3f09a38e3b5e90e2ccfc15a1 (diff) |
BREAKING(unstable): remove `Deno.HttpClient.rid` (#22075)
As part of ongoing works to make `rid` private.
---------
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
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; |