oven-sh/bun

Remove the undici polyfill

Ouverte

#17 799 ouverte le 28 févr. 2025

 (2 commentaires) (14 réactions) (0 personne assignée)Rust (4 486 forks)batch import
enhancementgood first issue

Métriques du dépôt

Stars
 (90 348 étoiles)
Métriques de merge PR
 (Merge moyen 1j 17h) (357 PRs mergées en 30 j)

Description

What is the problem this feature would solve?

Bun's fetch and WebSocket have an issue with headers casing (they're not the same as the ones we give, see https://github.com/Vexcited/tcp-websocket#why-not-directly-use-undici- for an example)

Using undici completely fixes that since it uses node:net and node:tls to make the requests instead of builtins.

What is the feature you are proposing to solve the problem?

Today, Bun supports undici out of the box.

Removing this polyfill would allow us to not do forks of it or import tweaks to prevent Bun pollyfing the import (see https://github.com/Vexcited/tcp-websocket/blob/main/src/index.ts)

Also it would help to have a package that does requests with the exact same API and outputs the same thing on all runtimes (I tested Deno, Node.js and Bun and it always produces the same output!)

undici is pollyfilled in

What alternatives have you considered?

Writing my own package that tweaks the imports to make sure Bun does not polyfill it, https://github.com/Vexcited/tcp-websocket

Guide contributeur