Skip to content

Commit 2d93e3d

Browse files
authored
fix for 46109 (Azure#46401)
1 parent 3a55d32 commit 2d93e3d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sdk/openai/Azure.AI.OpenAI/src/Custom/AzureTokenAuthenticationPolicy.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public override void Process(PipelineMessage message, IReadOnlyList<PipelinePoli
3434
TokenRequestContext tokenRequestContext = CreateRequestContext(message.Request);
3535
_currentToken = _credential.GetToken(tokenRequestContext, cancellationToken: default);
3636
}
37-
message?.Request?.Headers?.Add("Authorization", $"Bearer {_currentToken.Value.Token}");
37+
message?.Request?.Headers?.Set("Authorization", $"Bearer {_currentToken.Value.Token}");
3838
}
3939
ProcessNext(message, pipeline, currentIndex);
4040
if (message?.Response?.Status == (int)HttpStatusCode.Unauthorized)
@@ -53,7 +53,7 @@ public override async ValueTask ProcessAsync(PipelineMessage message, IReadOnlyL
5353
_currentToken
5454
= await _credential.GetTokenAsync(tokenRequestContext, cancellationToken: default).ConfigureAwait(false);
5555
}
56-
message?.Request?.Headers?.Add("Authorization", $"Bearer {_currentToken.Value.Token}");
56+
message?.Request?.Headers?.Set("Authorization", $"Bearer {_currentToken.Value.Token}");
5757
}
5858
await ProcessNextAsync(message, pipeline, currentIndex).ConfigureAwait(false);
5959
if (message?.Response?.Status == (int)HttpStatusCode.Unauthorized)

0 commit comments

Comments
 (0)