make Grpc.Auth build again

pull/19712/head
Jan Tattermusch 5 years ago
parent d4e778ca2f
commit fb85fb8c19
  1. 14
      src/csharp/Grpc.Auth/GoogleAuthInterceptors.cs

@ -61,7 +61,7 @@ namespace Grpc.Auth
return new AsyncAuthInterceptor((context, metadata) => return new AsyncAuthInterceptor((context, metadata) =>
{ {
metadata.Add(CreateBearerTokenHeader(accessToken)); metadata.Add(CreateBearerTokenHeader(accessToken));
return TaskUtils.CompletedTask; return GetCompletedTask();
}); });
} }
@ -69,5 +69,17 @@ namespace Grpc.Auth
{ {
return new Metadata.Entry(AuthorizationHeader, Schema + " " + accessToken); 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
}
} }
} }

Loading…
Cancel
Save