This commit is contained in:
Claire Novotny 2021-02-04 17:57:13 -05:00
Родитель d2d261f025
Коммит 64d91012c6
Не удалось извлечь подпись
3 изменённых файлов: 18 добавлений и 9 удалений

10
Directory.Build.targets Normal file
Просмотреть файл

@ -0,0 +1,10 @@
<Project>
<PropertyGroup Condition="'$(TargetFramework)' == 'net5.0'">
<DefineConstants>$(DefineConstants);NET5_0_OR_GREATER</DefineConstants>
</PropertyGroup>
</Project>

Просмотреть файл

@ -176,7 +176,7 @@ namespace Refit
return (client, args) => rxFunc!.DynamicInvoke(client, args);
}
async Task AddMultipartItemAsync(MultipartFormDataContent multiPartContent, string fileName, string parameterName, object itemValue)
void AddMultipartItem(MultipartFormDataContent multiPartContent, string fileName, string parameterName, object itemValue)
{
if (itemValue is HttpContent content)
@ -242,7 +242,7 @@ namespace Refit
throw new InvalidOperationException("BaseAddress must be set on the HttpClient instance");
var factory = BuildRequestFactoryForMethod(restMethod, client.BaseAddress.AbsolutePath, restMethod.CancellationToken != null);
var rq = await factory(paramList).ConfigureAwait(false);
var rq = factory(paramList);
HttpResponseMessage? resp = null;
HttpContent? content = null;
var disposeResponse = true;
@ -451,10 +451,9 @@ namespace Refit
return kvps;
}
Func<object[], Task<HttpRequestMessage>> BuildRequestFactoryForMethod(RestMethodInfo restMethod, string basePath, bool paramsContainsCancellationToken)
Func<object[], HttpRequestMessage> BuildRequestFactoryForMethod(RestMethodInfo restMethod, string basePath, bool paramsContainsCancellationToken)
{
return async paramList =>
return paramList =>
{
// make sure we strip out any cancellation tokens
if (paramsContainsCancellationToken)
@ -685,12 +684,12 @@ namespace Refit
{
foreach (var item in enumerable!)
{
await AddMultipartItemAsync(multiPartContent!, itemName, parameterName, item).ConfigureAwait(false);
AddMultipartItem(multiPartContent!, itemName, parameterName, item);
}
}
else
{
await AddMultipartItemAsync(multiPartContent!, itemName, parameterName, itemValue).ConfigureAwait(false);
AddMultipartItem(multiPartContent!, itemName, parameterName, itemValue);
}
}
@ -851,7 +850,7 @@ namespace Refit
throw new InvalidOperationException("BaseAddress must be set on the HttpClient instance");
var factory = BuildRequestFactoryForMethod(restMethod, client.BaseAddress.AbsolutePath, restMethod.CancellationToken != null);
var rq = await factory(paramList).ConfigureAwait(false);
var rq = factory(paramList);
var ct = CancellationToken.None;

Просмотреть файл

@ -33,7 +33,7 @@ stages:
- task: UseDotNet@2
displayName: Use .NET Core 5.x SDK
inputs:
version: 5.x
version: 5.0.x
performMultiLevelLookup: true
includePreviewVersions: true