Skip to content

Commit

Permalink
remove warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
clairernovotny committed Feb 4, 2021
1 parent d2d261f commit 64d9101
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
10 changes: 10 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project>


<PropertyGroup Condition="'$(TargetFramework)' == 'net5.0'">
<DefineConstants>$(DefineConstants);NET5_0_OR_GREATER</DefineConstants>
</PropertyGroup>



</Project>
15 changes: 7 additions & 8 deletions Refit/RequestBuilderImplementation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ RestMethodInfo CloseGenericMethodIfNeeded(RestMethodInfo restMethodInfo, Type[]?
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)
Expand Down Expand Up @@ -242,7 +242,7 @@ async Task AddMultipartItemAsync(MultipartFormDataContent multiPartContent, stri
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;
Expand Down Expand Up @@ -451,10 +451,9 @@ async Task AddMultipartItemAsync(MultipartFormDataContent multiPartContent, stri
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)
Expand Down Expand Up @@ -685,12 +684,12 @@ Func<object[], Task<HttpRequestMessage>> BuildRequestFactoryForMethod(RestMethod
{
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);
}
}

Expand Down Expand Up @@ -851,7 +850,7 @@ Func<HttpClient, object[], Task> BuildVoidTaskFuncForMethod(RestMethodInfo restM
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;

Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 64d9101

Please sign in to comment.