Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Typed unix socket and TLS options for `BunHttpClient` and `DenoHttpClient`

未关闭
#9,687 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@effect-bot 已经在做这个了。

开始于 2026年10月21日。

  • #9704 来自 @tim-smart —— 未关闭

评估

这个 Issue 还没有评估数据。

描述

docker-made-me-do-it enhancement platform

Problem

NodeHttpClient has typed layers for connecting over a unix socket and for custom TLS (#9158):

NodeHttpClient.layerUndiciOptions({ connect: { socketPath: "/var/run/docker.sock" } })
NodeHttpClient.layerUndiciOptions({ connect: { ca, cert, key, servername } })

Bun and Deno have nothing equivalent: BunHttpClient and DenoHttpClient only re-export FetchHttpClient. Both runtimes can do the same things, but only through fetch fields that aren't in the standard RequestInit:

  • Bun: fetch(url, { unix, tls: { ca, cert, key, rejectUnauthorized, serverName } })
  • Deno: fetch(url, { client }), where the client comes from Deno.createHttpClient({ caCerts, cert, key, proxy: { transport: "unix", path } }) and has to be closed afterwards.

You can get there by providing FetchHttpClient.RequestInit or a custom Fetch, but it isn't documented, and the types don't fit. Effect's own Kubernetes integration, which only needs to trust one CA file, does it three different ways:

  • Node: an undici Agent (packages/platform/node/src/NodeClusterSocket.ts:150-174).
  • Bun: { tls: { ca } } as any (packages/platform/bun/src/BunClusterSocket.ts:156-160).
  • Deno: a wrapped fetch that injects client with as any and closes it when the scope ends (packages/platform/deno/src/DenoClusterSocket.ts:197-201).

Anyone who needs the Docker socket on Bun, or a client certificate on Deno, has to rediscover all of this.

Proposal

One layer per runtime that takes that runtime's own options, the same way the Node layers take undici's options:

BunHttpClient.layerOptions({ unix: "/var/run/docker.sock" })
BunHttpClient.layerOptions({ tls: { ca, cert, key } })

DenoHttpClient.layerOptions({ proxy: { transport: "unix", path: "/var/run/docker.sock" } })
DenoHttpClient.layerOptions({ caCerts: [ca], cert, key })
  • Bun passes the options into every fetch call.
  • Deno creates the Deno.HttpClient in the layer's scope and closes it when the scope ends.
  • The JSDoc for each layer says what is supported. For example, Deno has no option to skip certificate verification or to set the server name.

Then switch the Bun and Deno Kubernetes layers over and remove the casts.

Why in Effect

HttpClient is meant to be portable, yet on two of the three server runtimes these settings are only reachable through untyped, undocumented fields. This is the Node change from #9158 applied to Bun and Deno, with no new concepts.

Scope

In scope:

  • layerOptions for Bun and Deno, with docs.
  • Using them in the Kubernetes layers.

Out of scope:

  • A connection or TLS type shared by all runtimes.
  • http+unix:// URLs, which have no standard scheme.
  • Per-request connection settings.
主要语言
TypeScript
星标
16.7k
派生
808
平均合并
10 小时 7 分钟
30 天内合并 PR
808

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Effect-TS/effect 的其他 Issue

查看 Effect-TS/effect 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。