StandardHttpClient setting Authentication Header incorrectly in a couple of places.
This commit is contained in:
parent
6fd960d403
commit
70c4936e14
@ -40,7 +40,7 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http
|
|||||||
throw new ArgumentException("Value must be either post or put.", nameof(method));
|
throw new ArgumentException("Value must be either post or put.", nameof(method));
|
||||||
}
|
}
|
||||||
|
|
||||||
// a new StringContent must be created for each retry
|
// a new StringContent must be created for each retry
|
||||||
// as it is disposed after each call
|
// as it is disposed after each call
|
||||||
|
|
||||||
var requestMessage = new HttpRequestMessage(HttpMethod.Post, uri);
|
var requestMessage = new HttpRequestMessage(HttpMethod.Post, uri);
|
||||||
@ -59,7 +59,7 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http
|
|||||||
|
|
||||||
var response = await _client.SendAsync(requestMessage);
|
var response = await _client.SendAsync(requestMessage);
|
||||||
|
|
||||||
// raise exception if HttpResponseCode 500
|
// raise exception if HttpResponseCode 500
|
||||||
// needed for circuit breaker to track fails
|
// needed for circuit breaker to track fails
|
||||||
|
|
||||||
if (response.StatusCode == HttpStatusCode.InternalServerError)
|
if (response.StatusCode == HttpStatusCode.InternalServerError)
|
||||||
@ -73,12 +73,12 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http
|
|||||||
|
|
||||||
public async Task<HttpResponseMessage> PostAsync<T>(string uri, T item, string authorizationToken = null, string requestId = null, string authorizationMethod = "Bearer")
|
public async Task<HttpResponseMessage> PostAsync<T>(string uri, T item, string authorizationToken = null, string requestId = null, string authorizationMethod = "Bearer")
|
||||||
{
|
{
|
||||||
return await DoPostPutAsync(HttpMethod.Post, uri, item, authorizationToken, requestId, authorizationToken);
|
return await DoPostPutAsync(HttpMethod.Post, uri, item, authorizationToken, requestId, authorizationMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<HttpResponseMessage> PutAsync<T>(string uri, T item, string authorizationToken = null, string requestId = null, string authorizationMethod = "Bearer")
|
public async Task<HttpResponseMessage> PutAsync<T>(string uri, T item, string authorizationToken = null, string requestId = null, string authorizationMethod = "Bearer")
|
||||||
{
|
{
|
||||||
return await DoPostPutAsync(HttpMethod.Put, uri, item, authorizationToken, requestId, authorizationToken);
|
return await DoPostPutAsync(HttpMethod.Put, uri, item, authorizationToken, requestId, authorizationMethod);
|
||||||
}
|
}
|
||||||
public async Task<HttpResponseMessage> DeleteAsync(string uri, string authorizationToken = null, string requestId = null, string authorizationMethod = "Bearer")
|
public async Task<HttpResponseMessage> DeleteAsync(string uri, string authorizationToken = null, string requestId = null, string authorizationMethod = "Bearer")
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user