Skip to content

Commit ecc92b1

Browse files
[bug] Quick fix for handling non 200 status codes when loading specs from URI (#1695)
* Quick fix for handling non 200 status codes when loading specs from URI Go http client already handles 3xx responses for us * note
1 parent 9f5f063 commit ecc92b1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/supportbundle/load.go

+8
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,14 @@ func loadSpecFromURL(arg string) ([]byte, error) {
252252
}
253253
return nil, errors.Wrap(err, "execute request")
254254
}
255+
256+
// handle non 2xx http statuses
257+
// redirects appear to already be handled by the go http client
258+
// TODO: handle potential for redirect loops breaking this?
259+
if resp.StatusCode != 200 {
260+
return nil, errors.New("request returned non 200 response")
261+
}
262+
255263
defer resp.Body.Close()
256264

257265
body, err := io.ReadAll(resp.Body)

0 commit comments

Comments
 (0)