Skip to content

Add some improvments for handling the response body#192

Merged
ncw merged 1 commit intoncw:masterfrom
NinniPat:addResponseBody
Feb 4, 2026
Merged

Add some improvments for handling the response body#192
ncw merged 1 commit intoncw:masterfrom
NinniPat:addResponseBody

Conversation

@NinniPat
Copy link
Copy Markdown
Contributor

@NinniPat NinniPat commented Feb 3, 2026

In v.2.0.5 the response body is now appended to the error. However, there are two possible improvements to this code. Firstly, if the response body reader returned io.EOF we would not append the response body. Secondly, it's difficult to extract the response body from the error when it's simply wrapped. Instead we will now return an ErrorWithBody.

Change-Id: I21b3001a001a2cacf3be4a767f89987b9b829530

In v.2.0.5 the response body is now appended to the error. However,
there are two possible improvements to this code. Firstly, if the
response body reader returned io.EOF we would not append the response
body. Secondly, it's difficult to extract the response body from the
error when it's simply wrapped. Instead we will now return an
ErrorWithBody.

Change-Id: I21b3001a001a2cacf3be4a767f89987b9b829530
Copy link
Copy Markdown
Owner

@ncw ncw left a comment

Choose a reason for hiding this comment

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

Nice change, thank you.

Will merge now

@ncw ncw merged commit 06800b7 into ncw:master Feb 4, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants