Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
feat: print response body in error for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed Mar 21, 2023
1 parent 7c783c5 commit a26351b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ func (ps *proxyRouting) fetch(ctx context.Context, key string) (rb []byte, err e
}
defer resp.Body.Close()

if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("routing/get RPC returned unexpected status: %s", resp.Status)
}

rb, err = io.ReadAll(resp.Body)
if err != nil {
return nil, err
}

if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("routing/get RPC returned unexpected status: %s, body: %s", resp.Status, string(rb))
}

parts := bytes.Split(bytes.TrimSpace(rb), []byte("\n"))
var b64 string

Expand Down

0 comments on commit a26351b

Please sign in to comment.