fix: return proper error if OIDC Discoverydoc fails to respond (#17242)

This commit is contained in:
jiuker
2023-05-19 17:13:33 +08:00
committed by GitHub
parent 7d433f16c4
commit e94e6adf91
2 changed files with 2 additions and 2 deletions

View File

@@ -279,7 +279,7 @@ func parseDiscoveryDoc(u *xnet.URL, transport http.RoundTripper, closeRespFn fun
}
defer closeRespFn(resp.Body)
if resp.StatusCode != http.StatusOK {
return d, err
return d, fmt.Errorf("unexpected error returned by %s : status(%s)", u, resp.Status)
}
dec := json.NewDecoder(resp.Body)
if err = dec.Decode(&d); err != nil {