Why if I add authorization header with right token in my custom DelegatingHandler to the request without this header, I get the response: 401 authorization required?
public class ProxyHandler : DelegatingHandler
{
protected async override Task<HttpResponseMessage> SendAsync(
HttpRequestMessage request, CancellationToken cancellationToken)
{
request.Headers.Add("Authorization", "Bearer rightToken...");
return response = await base.SendAsync(request, cancellationToken);
}
}
If I send the request from postman with the same authorization header, I got 200 OK.