Ensure failed oauth registration response is read before accessing response.text (#1118)
Co-authored-by: ihrpr <inna@anthropic.com>
This commit is contained in:
parent
ee54acbfa3
commit
81fe63a81d
1 changed files with 37 additions and 0 deletions
|
|
@ -308,6 +308,7 @@ class OAuthClientProvider(httpx.Auth):
|
|||
async def _handle_registration_response(self, response: httpx.Response) -> None:
|
||||
"""Handle registration response."""
|
||||
if response.status_code not in (200, 201):
|
||||
await response.aread()
|
||||
raise OAuthRegistrationError(f"Registration failed: {response.status_code} {response.text}")
|
||||
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in a new issue