Skip to content

Return ErrReaderNotSeekable instead of sending empty bodies on retry#1156

Merged
jeevatkm merged 3 commits into
go-resty:v3from
Shopify:fix-retry-non-seekable
May 2, 2026
Merged

Return ErrReaderNotSeekable instead of sending empty bodies on retry#1156
jeevatkm merged 3 commits into
go-resty:v3from
Shopify:fix-retry-non-seekable

Conversation

@pior
Copy link
Copy Markdown
Contributor

@pior pior commented Apr 24, 2026

If we SetBody() is called with a non-retriable reader, retries will be sent with empty body.

A similar bug with the multipart reader was fixed in #1133.
The original discussion: #1127.

This PR follows the same logic: return ErrReaderNotSeekable instead of silently sending an empty body.

Breaking: the actual text of ErrReaderNotSeekable is changed to make the error generic, multipart is removed.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.78%. Comparing base (f1a4f02) to head (4ef6055).
⚠️ Report is 5 commits behind head on v3.

Additional details and impacted files
@@           Coverage Diff           @@
##               v3    #1156   +/-   ##
=======================================
  Coverage   99.77%   99.78%           
=======================================
  Files          20       20           
  Lines        4049     4113   +64     
=======================================
+ Hits         4040     4104   +64     
  Misses          6        6           
  Partials        3        3           
Flag Coverage Δ
unittests 99.78% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Member

@jeevatkm jeevatkm left a comment

Choose a reason for hiding this comment

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

@pior Thanks for the PR, can you please check patch coverage failure?

@jeevatkm
Copy link
Copy Markdown
Member

@pior ping, any updates?

@pior pior force-pushed the fix-retry-non-seekable branch from 592f83e to 4ef6055 Compare April 30, 2026 09:49
@pior pior requested a review from jeevatkm April 30, 2026 10:07
Copy link
Copy Markdown
Member

@jeevatkm jeevatkm left a comment

Choose a reason for hiding this comment

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

@pior Thanks for the PR.

@jeevatkm jeevatkm added this to the v3.0.0 Milestone milestone May 2, 2026
@jeevatkm jeevatkm merged commit db80558 into go-resty:v3 May 2, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants