Skip to content

Commit

Permalink
消除HttpRequestMessage包装自身的可能
Browse files Browse the repository at this point in the history
  • Loading branch information
xljiulang committed Feb 1, 2021
1 parent a6b964d commit 66ede4a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions WebApiClientCore/Implementations/DefaultApiActionInvoker.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Net.Http;
using System.Runtime.ExceptionServices;
using System.Threading.Tasks;
using WebApiClientCore.Exceptions;
using WebApiClientCore.Implementations.Tasks;
Expand Down Expand Up @@ -60,7 +61,7 @@ public virtual async Task<TResult> InvokeAsync(HttpClientContext context, object
var useDefaultUserAgent = context.HttpApiOptions.UseDefaultUserAgent;
using var requestMessage = new HttpApiRequestMessageImpl(requiredUri, useDefaultUserAgent);

var httpContext = new HttpContext(context, requestMessage);
var httpContext = new HttpContext(context, requestMessage);
var requestContext = new ApiRequestContext(httpContext, this.ActionDescriptor, arguments, new DefaultDataCollection());
return await this.InvokeAsync(requestContext).ConfigureAwait(false);
}
Expand Down Expand Up @@ -91,8 +92,7 @@ private async Task<TResult> InvokeAsync(ApiRequestContext request)

if (response.ResultStatus == ResultStatus.HasException)
{
var inner = response.Exception;
throw new HttpRequestException(inner.Message, inner);
ExceptionDispatchInfo.Capture(response.Exception).Throw();
}

throw new ApiReturnNotSupportedExteption(response);
Expand Down

0 comments on commit 66ede4a

Please sign in to comment.