fix: drain Identity error body (keep-alive); reject whitespace-only credential fields in form
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -118,6 +118,9 @@ func (c *Client) authenticate(ctx context.Context, cr Creds) (string, time.Time,
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
if resp.StatusCode != http.StatusCreated && resp.StatusCode != http.StatusOK {
|
||||
// Drain the body so the underlying connection can be reused by the
|
||||
// transport's keep-alive pool; the error itself stays generic.
|
||||
io.Copy(io.Discard, resp.Body)
|
||||
return "", time.Time{}, fmt.Errorf("selectel: identity auth failed: %d", resp.StatusCode)
|
||||
}
|
||||
tok := resp.Header.Get("X-Subject-Token")
|
||||
|
||||
Reference in New Issue
Block a user