Bun.serve: rename `h3`/`h1` options to `http3`/`http1`

Merged
JA
6mo ago
+130-83

What

Renames the Bun.serve() ServerConfig HTTP/3 options from the abbreviated h3 / h1 to the spelled-out http3 / http1.

// before
Bun.serve({ tls, h3: true, h1: false, fetch })

// after
Bun.serve({ tls, http3: true, http1: false, fetch })

These options have not shipped in a release yet, so this is a clean rename with no backwards-compat aliases.

Changes

  • src/runtime/server/ServerConfig.zig / server.zig: rename the ServerConfig struct fields and the JS option lookups (arg.get(global, "http3"), etc.); update the validation error messages and the unix-socket warning.
  • packages/bun-types/serve.d.ts: rename the type declarations, drop the incorrect "(and HTTP/2)" from the http1 JSDoc (Bun.serve does not support HTTP/2), and mark both options @experimental.
  • docs/runtime/http/server.mdx: add an "HTTP/3 (QUIC)" section documenting http3 / http1, Alt-Svc, the unix-socket limitation, and the experimental status.
  • Tests: update Bun.serve({ http3, http1 }) call sites, test names, and the validation error-message assertion across the HTTP/3 suites (serve-http3.test.ts, serve-protocols.test.ts, body-stream.test.ts, fetch-http3-client.test.ts, fetch-http3-adversarial.test.ts, direct-readable-stream.test.tsx, fetch-h3.ts, packages/h3blast/).

Notes

  • The internal uws.AnyRequest union variants (.h1/.h3) are left as-is — those tag a transport, not a config option.
  • The fetch() protocol option ("http1.1" | "h1" | "http2" | "h2" | "http3" | "h3") is unchanged; it already accepts both spellings.
  • zig:check and the bun-types tsc test pass locally. The full HTTP/3 test suite will run in CI.