Skip to content

Commit 2a27b16

Browse files
committed
grpc/interceptor: check success status code when fetching github token
1 parent e2122df commit 2a27b16

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/grpc/interceptor/auth/client.go

+4
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ func (g *GitHubTokenInterceptor) Token(ctx context.Context) (string, error) {
112112
}
113113
defer resp.Body.Close()
114114

115+
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
116+
return "", fmt.Errorf("unexpected status code: %s", resp.Status)
117+
}
118+
115119
body, err := io.ReadAll(resp.Body)
116120
if err != nil {
117121
return "", fmt.Errorf("reading body: %w", err)

0 commit comments

Comments
 (0)