Skip to content

Commit

Permalink
rpc/awscreds: fail on unexpected status from instance profile name en…
Browse files Browse the repository at this point in the history
…dpoint (#70)
  • Loading branch information
patrislav authored Oct 1, 2024
1 parent 1f384a9 commit 6f77143
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions rpc/awscreds/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ func (p *Provider) getInstanceProfileName(ctx context.Context) (string, error) {
}
defer res.Body.Close()

if res.StatusCode != http.StatusOK {
return "", fmt.Errorf("unexpected status: %s", res.Status)
}

b, err := io.ReadAll(res.Body)
if err != nil {
return "", fmt.Errorf("reading response body: %w", err)
Expand Down

0 comments on commit 6f77143

Please sign in to comment.