diff --git a/Agoda.Frameworks.Http.AutoRestExt/ExecuteResult.cs b/Agoda.Frameworks.Http.AutoRestExt/ExecuteResult.cs index 8b250ac..dfc0590 100644 --- a/Agoda.Frameworks.Http.AutoRestExt/ExecuteResult.cs +++ b/Agoda.Frameworks.Http.AutoRestExt/ExecuteResult.cs @@ -61,8 +61,7 @@ private Exception BuildAggregateException() foreach (var ex in Exceptions) { sb.Append(string.Format("\r\n - \"{0}\" -> {1}", ex.Uri, ex.Message)); - } - + } return new Exception(sb.ToString()); } } diff --git a/Agoda.Frameworks.Http/RandomUrlHttpClient.cs b/Agoda.Frameworks.Http/RandomUrlHttpClient.cs index c6be967..fd41360 100644 --- a/Agoda.Frameworks.Http/RandomUrlHttpClient.cs +++ b/Agoda.Frameworks.Http/RandomUrlHttpClient.cs @@ -111,6 +111,15 @@ public Task PutJsonAsync(string url, string json) => public Task DeleteAsync(string url) => SendAsync(url, uri => HttpClient.DeleteAsync(uri)); + public async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) + { + return await SendAsync(request.RequestUri.PathAndQuery, (url) => + { + request.RequestUri = new Uri(url); + return HttpClient.SendAsync(request, cancellationToken); + }); + } + public Task SendAsync( string url, Func requestMsg) => @@ -155,7 +164,7 @@ private Task>> Send { throw new TransientHttpRequestException( url, - combinedUrl, + combinedUrl, res, $"Response status code does not indicate success: ${res.StatusCode}"); }