make Grpc.Auth build again

This commit is contained in:
Jan Tattermusch 2019-07-30 11:44:02 -07:00
parent d4e778ca2f
commit fb85fb8c19
1 changed files with 13 additions and 1 deletions

View File

@ -61,7 +61,7 @@ namespace Grpc.Auth
return new AsyncAuthInterceptor((context, metadata) =>
{
metadata.Add(CreateBearerTokenHeader(accessToken));
return TaskUtils.CompletedTask;
return GetCompletedTask();
});
}
@ -69,5 +69,17 @@ namespace Grpc.Auth
{
return new Metadata.Entry(AuthorizationHeader, Schema + " " + accessToken);
}
/// <summary>
/// Framework independent equivalent of <c>Task.CompletedTask</c>.
/// </summary>
private static Task GetCompletedTask()
{
#if NETSTANDARD1_5 || NETSTANDARD2_0
return Task.CompletedTask;
#else
return Task.FromResult<object>(null); // for .NET45, emulate the functionality
#endif
}
}
}