Skip to content

Commit

Permalink
fix: Handle empty credentials in RestChannel
Browse files Browse the repository at this point in the history
(This allows the use of ChannelCredentials.Insecure for example.)
  • Loading branch information
jskeet committed Sep 6, 2022
1 parent ad85def commit 533703d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Google.Api.Gax.Grpc/Rest/RestChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ private async Task<ReadHttpResponseMessage> SendAsync<TRequest>(RestMethod restM

private async Task AddAuthHeadersAsync(HttpRequestMessage request, RestMethod restMethod, CancellationToken combinedCancellationToken)
{
if (_channelAuthInterceptor is null)
{
return;
}

Uri hostUri = request.RequestUri.IsAbsoluteUri ? request.RequestUri : _httpClient.BaseAddress;
string schemeAndAuthority = hostUri.GetLeftPart(UriPartial.Authority);

Expand Down

0 comments on commit 533703d

Please sign in to comment.