Skip to content

Commit

Permalink
feat: warn if there is an EOF
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Gleich <[email protected]>
  • Loading branch information
gleich committed Jan 7, 2025
1 parent 74580c2 commit 60051fc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/apis/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ func SendRequest[T any](req *http.Request) (T, error) {
defer resp.Body.Close()

body, err := io.ReadAll(resp.Body)
if errors.Is(err, io.EOF) {
lumber.Warning("EOF from", req.URL.String())
return zeroValue, WarningError
}
if err != nil {
lumber.Error(err, "reading response body failed")
return zeroValue, err
Expand Down

0 comments on commit 60051fc

Please sign in to comment.