grpc / grpc-web

gRPC for Web Clients
https://grpc.io
Apache License 2.0
8.45k stars 760 forks source link

Client does not report correct error codes per the spec for HTTP status code mapping #1427

Open jhump opened 1 month ago

jhump commented 1 month ago

A well-formed gRPC response always has an HTTP status code of “200 OK”. The gRPC docs specify a table for mapping other HTTP status codes to gRPC error codes: https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md.

The client in this package varies from the above table. Specifically, here are HTTP status codes which produce an unexpected error code:

HTTP status code Expected error code Actual error code
400 Bad Request internal unknown
404 Not Found unimplemented unknown
409 Conflict unknown aborted
412 Precondition Failed unknown failed_precondition
429 Too Many Requests unavailable unknown
502 Bad Gateway unavailable unknown
504 Gateway Timeout unavailable unknown
sampajano commented 1 month ago

@jhump Thanks a lot for reporting! Will take a look soon!