grpc / grpc-dart

The Dart language implementation of gRPC.
https://pub.dev/packages/grpc
Apache License 2.0
860 stars 271 forks source link

grpc-web might need to default grpc-status to 0 when missing #566

Closed mraleph closed 2 years ago

mraleph commented 2 years ago

It seems there is a discrepancy in how native protocol and gRPC-Web are handling grpc-status. This discrepancy does not seem to be documented in gRPC-Web spec here, but it becomes obvious when comparing implementations.

Native gRPC protocol describes grpc-status as an always present:

Status must be sent in Trailers even if the status code is OK.

Implementations handle missing grpc-status as an error. See e.g. Java implementation.

gRPC-Web protocol description does not mention any difference to native protocol with respect to status handling, but looking at the implementation we discover that it defaults status to OK if it is missing.

We have not observed such behaviour when testing with Envoy, but apparently there are servers out there which would omit OK status.

It's unclear whether server is compliant to gRPC-Web specificiation here or whether default implementation is simply lenient. @wenbozhu could you provide the guidance here?

sampajano commented 2 years ago

Yes, per our understanding, grpc-status should be mandatory.

But I'm not sure why exactly is the grpc-web code allows it to be empty. :)

mraleph commented 2 years ago

Thanks @sampajano.

Resolving this as the current behaviour matches the intent.