@ -128,41 +128,41 @@ namespace Volo.Abp.Http.Client.DynamicProxying
private async Task < string > MakeRequestAsync ( IAbpMethodInvocation invocation )
{
using ( var client = HttpClientFactory . Create ( ) )
{
var clientConfig = ClientOptions . HttpClientProxies . GetOrDefault ( typeof ( TService ) ) ? ? throw new AbpException ( $"Could not get DynamicHttpClientProxyConfig for {typeof(TService).FullName}." ) ;
var remoteServiceConfig = RemoteServiceOptions . RemoteServices . GetConfigurationOrDefault ( clientConfig . RemoteServiceName ) ;
var clientConfig = ClientOptions . HttpClientProxies . GetOrDefault ( typeof ( TService ) ) ? ? throw new AbpException ( $"Could not get DynamicHttpClientProxyConfig for {typeof(TService).FullName}." ) ;
var remoteServiceConfig = RemoteServiceOptions . RemoteServices . GetConfigurationOrDefault ( clientConfig . RemoteServiceName ) ;
var action = await ApiDescriptionFinder . FindActionAsync ( remoteServiceConfig . BaseUrl , typeof ( TService ) , invocation . Method ) ;
var apiVersion = GetApiVersionInfo ( action ) ;
var url = remoteServiceConfig . BaseUrl + UrlBuilder . GenerateUrlWithParameters ( action , invocation . ArgumentsDictionary , apiVersion ) ;
var client = HttpClientFactory . Create ( clientConfig . RemoteServiceName ) ;
var requestMessage = new HttpRequestMessage ( action . GetHttpMethod ( ) , url )
{
Content = RequestPayloadBuilder . BuildContent ( action , invocation . ArgumentsDictionary , JsonSerializer , apiVersion )
} ;
AddHeaders ( invocation , action , requestMessage , apiVersion ) ;
await ClientAuthenticator . Authenticate (
new RemoteServiceHttpClientAuthenticateContext (
client ,
requestMessage ,
remoteServiceConfig ,
clientConfig . RemoteServiceName
)
) ;
var action = await ApiDescriptionFinder . FindActionAsync ( remoteServiceConfig . BaseUrl , typeof ( TService ) , invocation . Method ) ;
var apiVersion = GetApiVersionInfo ( action ) ;
var url = remoteServiceConfig . BaseUrl + UrlBuilder . GenerateUrlWithParameters ( action , invocation . ArgumentsDictionary , apiVersion ) ;
var response = await client . SendAsync ( requestMessage , GetCancellationToken ( ) ) ;
var requestMessage = new HttpRequestMessage ( action . GetHttpMethod ( ) , url )
{
Content = RequestPayloadBuilder . BuildContent ( action , invocation . ArgumentsDictionary , JsonSerializer , apiVersion )
} ;
if ( ! response . IsSuccessStatusCode )
{
await ThrowExceptionForResponseAsync ( response ) ;
}
AddHeaders ( invocation , action , requestMessage , apiVersion ) ;
return await response . Content . ReadAsStringAsync ( ) ;
await ClientAuthenticator . Authenticate (
new RemoteServiceHttpClientAuthenticateContext (
client ,
requestMessage ,
remoteServiceConfig ,
clientConfig . RemoteServiceName
)
) ;
var response = await client . SendAsync ( requestMessage , GetCancellationToken ( ) ) ;
if ( ! response . IsSuccessStatusCode )
{
await ThrowExceptionForResponseAsync ( response ) ;
}
}
return await response . Content . ReadAsStringAsync ( ) ;
}
private ApiVersionInfo GetApiVersionInfo ( ActionApiDescriptionModel action )
{