Skip to content

Commit

Permalink
address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ganeshvanahalli committed Mar 25, 2024
1 parent 23aae50 commit daaf7ca
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion util/headerreader/blob_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,14 @@ func beaconRequest[T interface{}](b *BlobClient, ctx context.Context, beaconPath
return nil, err
}
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("response returned with status code %d, want 200 (OK)", resp.StatusCode)
body, _ := io.ReadAll(resp.Body)
bodyStr := string(body)
log.Debug("beacon request returned response with non 200 OK status", "status", resp.Status, "body", bodyStr)
if len(bodyStr) > 100 {
return nil, fmt.Errorf("response returned with status %s, want 200 OK. body: %s ", resp.Status, bodyStr[len(bodyStr)-trailingCharsOfResponse:])
} else {
return nil, fmt.Errorf("response returned with status %s, want 200 OK. body: %s", resp.Status, bodyStr)
}
}
return resp, nil
}
Expand Down

0 comments on commit daaf7ca

Please sign in to comment.