I'm sending trailers from the server to the client, but on the client I can't access these trailers.
Server:
// UserContract.cs
public Task<User> GetUserAsync(UserDto userDto, CallContext context = default)
{
try
{
throw new NotImplementedException();
}
catch
{
Metadata metadata = new Metadata { { "test", "testvalue" } };
throw new RpcException(new Status(StatusCode.Internal, "Error"), metadata);
}
}
Client (Blazor):
try
{
await this.FactoryGrpc.CreateService<IUserContract>().GetUserAsync(userDto);
}
catch (RpcException exp)
{
if (exp.Trailers.Count == 0)
{
this.Popup.ShowMessage("Where's the trailer?");
return;
}
this.Popup.ShowMessage(exp.Trailers.GetValue("test"));
}
It's entering the if. Trailer count is 0 when it should be 1.