Skip to content

Commit 8936f13

Browse files
committed
AuthenticatedMessageHandler should skip if no provider has been set
This allows an application to use Flurl alongside OpenStack.NET without us trying to authenticate at inappropriate times.
1 parent e5d11f1 commit 8936f13

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/corelib/Authentication/AuthenticatedMessageHandler.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ public AuthenticatedMessageHandler(HttpMessageHandler innerHandler)
2121

2222
protected async override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
2323
{
24+
if(AuthenticationProvider == null)
25+
return await base.SendAsync(request, cancellationToken).ConfigureAwait(false);
26+
2427
string token = await AuthenticationProvider.GetToken(cancellationToken).ConfigureAwait(false);
2528
request.Headers.SetAuthToken(token);
2629

0 commit comments

Comments
 (0)