Skip to content

Fix: Provide body on retry error, preserve socket#4228

Merged
metcoder95 merged 3 commits intonodejs:mainfrom
fatal10110:fix_retry_handler
Jun 12, 2025
Merged

Fix: Provide body on retry error, preserve socket#4228
metcoder95 merged 3 commits intonodejs:mainfrom
fatal10110:fix_retry_handler

Conversation

@fatal10110
Copy link
Contributor

@fatal10110 fatal10110 commented May 17, 2025

This relates to...

Trying to fix #4222

I didn't touch any ranged/partial content behaviour, as it is unexpected server response and I guess should really throw an error in this case.

Rationale

Currently retry-handler has two issues

  1. It destroys the socket on each retry
  2. We loose the body on retry failure

Changes

Added a flag to make the handler react to "retry" callback result, and apply relevan functionality, instead of throwing the error immediately

Bug Fixes

#4222

Breaking Changes and Deprecations

in old flow, throw moved from onResponseStart to onResponseEnd which should not affect anyone as callbacks are not propogated

Status

@fatal10110 fatal10110 force-pushed the fix_retry_handler branch 3 times, most recently from 230ec24 to c48ed92 Compare May 19, 2025 19:26
@fatal10110 fatal10110 force-pushed the fix_retry_handler branch from c48ed92 to 58e326b Compare May 19, 2025 19:47
@fatal10110 fatal10110 marked this pull request as ready for review May 19, 2025 19:57
@fatal10110 fatal10110 changed the title [WIP] Fix: Provide body on retry error, preserve socket Fix: Provide body on retry error, preserve socket May 20, 2025
@fatal10110
Copy link
Contributor Author

I do not think CI failure is somehow related to this PR

@fatal10110
Copy link
Contributor Author

@Uzlopak @mcollina Kind ping, is this PR missing someting ?

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina requested review from metcoder95 and ronag May 28, 2025 15:47
Copy link
Member

@metcoder95 metcoder95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, just smaller typos

fatal10110 and others added 2 commits May 30, 2025 19:37
Co-authored-by: Carlos Fuentes <me@metcoder.dev>
Co-authored-by: Carlos Fuentes <me@metcoder.dev>
@fatal10110
Copy link
Contributor Author

Anything else required here?

@metcoder95 metcoder95 merged commit dbba3eb into nodejs:main Jun 12, 2025
29 of 31 checks passed
@github-actions github-actions bot mentioned this pull request Jun 26, 2025
slagiewka pushed a commit to slagiewka/undici that referenced this pull request Feb 14, 2026
Co-authored-by: Carlos Fuentes <me@metcoder.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants