Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Adjust HTTPError to read response body before it is closed #361

Merged
merged 2 commits into from
May 27, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Remove response size limitation
  • Loading branch information
Nathan committed May 26, 2021
commit a7befe2670cf42b85a626763302e61328407312f
2 changes: 1 addition & 1 deletion coder-sdk/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type APIErrorMsg struct {
// an *APIError.
func NewHTTPError(resp *http.Response) *HTTPError {
var buf bytes.Buffer
_, err := io.CopyN(&buf, resp.Body, 1<<20)
_, err := io.Copy(&buf, resp.Body)
Copy link
Member

Choose a reason for hiding this comment

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

👍 nice simplification. I can't think of a case where the error body would be excessively large.

if err != nil {
return &HTTPError{
cachedErr: err,
Expand Down