-
Notifications
You must be signed in to change notification settings - Fork 597
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
Retry Handler Fails When Request Has a Body #3288
Comments
This is indeed tricky. On one hand, state altering verbs should not be automatically retried, on the other hand, it's a pretty common case. |
It might be better to just scope this to the safe methods only Tho the issue seems to root the Not sure what will be the course of action here, I'd say that maybe the handler can make a best attempt to detect specific bodies (Stream, AsyncIterable) and clone them and attempt to free them after successful request. Just will add the overhead of duplicated bodies |
I think the fix here is to avoid the use of an AsyncIterable in fetch if the full body was specified. We can save quite a bit of overhead. |
FWIW I tested directly with |
Streams should not be possible to handle correctly unless they were 0 length. |
Bug Description
When a body is provided to a request, such as in a
PUT
request, the retry handler fails withUND_ERR_REQ_CONTENT_LENGTH_MISMATCH
.Reproducible By
repro.ts:
Expected Behavior
The request should be retried and should not fail because
undici
fails to handle re-use of thebody
correctly.Logs & Screenshots
Environment
Additional context
None
The text was updated successfully, but these errors were encountered: