-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Behaviour mismatch: Fetch with content-length: 0
fails with undici error
#193
Comments
Hey! 👋 Thanks for raising this. Should be possible to remove the miniflare/packages/core/src/standards/http.ts Lines 762 to 769 in b887877
|
Any chance this could be released as a patch version? I ran into the Stripe SDK issue so I'm using a |
I second @dpeek , I've been running a personal duplicate of Stripe that removes the header if 0 for now, but would be nice to be able to keep up with Stripe updates. |
Hey! 👋 I've just released version |
Attempting to
fetch
withcontent-length: 0
results in an error fromundici
. This is tolerated in real Workers env:Steps to reproduce:
expected behaviour:
Request succeeds (worker returns the httpbin 200 response).
Actual behaviour
This originates from undici's strictness; they deliberately treat the req as invalid, it's not a bug from their POV. See undici issue 649 for example. They offer a non-strict mode to turn this and other behaviours into warnings, but I don't think miniflare supports enabling this mode?
This does not match behaviour of CF deployed workers. Moreover, there is code in the wild that explicitly and deliberately adds
content-length: 0
to certain requests. For example, popular NPM lib node-http-proxy; I believe Envoy proxy does similar.(this shares some DNA with recent miniflare issues like #183 and #182: undici's design goals, while reasonable in some contexts, don't always seem to align with CF Workers' server-side-oriented
fetch
impl)The text was updated successfully, but these errors were encountered: