Include response body in HttpRequestException for transport client errors (#1193)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
This commit is contained in:
parent
482e311a70
commit
7c85ac6706
1 changed files with 149 additions and 6 deletions
|
|
@ -499,7 +499,7 @@ internal sealed partial class ClientOAuthProvider : McpHttpClient
|
|||
};
|
||||
|
||||
using var httpResponse = await _httpClient.SendAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
httpResponse.EnsureSuccessStatusCode();
|
||||
await httpResponse.EnsureSuccessStatusCodeWithResponseBodyAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var tokens = await HandleSuccessfulTokenResponseAsync(httpResponse, cancellationToken).ConfigureAwait(false);
|
||||
LogOAuthAuthorizationCompleted();
|
||||
|
|
@ -544,7 +544,7 @@ internal sealed partial class ClientOAuthProvider : McpHttpClient
|
|||
using var httpResponse = await _httpClient.GetAsync(metadataUrl, cancellationToken).ConfigureAwait(false);
|
||||
if (requireSuccess)
|
||||
{
|
||||
httpResponse.EnsureSuccessStatusCode();
|
||||
await httpResponse.EnsureSuccessStatusCodeWithResponseBodyAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
else if (!httpResponse.IsSuccessStatusCode)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue