Skip to content
Merged
Changes from all commits
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
5 changes: 4 additions & 1 deletion pkg/util/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ import (
//
// action is a short verb phrase describing what failed, e.g. "create upload session".
func FormatHTTPError(action string, resp *http.Response) error {
body, _ := io.ReadAll(resp.Body)
body, err := io.ReadAll(io.LimitReader(resp.Body, 1<<20))
if err != nil {
return fmt.Errorf("%s: failed to read response body (status: %d): %w", action, resp.StatusCode, err)
}
Comment on lines +23 to +26

var errResp struct {
Code string `json:"code"`
Expand Down