grpc-gateway icon indicating copy to clipboard operation
grpc-gateway copied to clipboard

Incorrect mapping from grpc code to http code for `canceled request`.

Open brijeshvishwanath opened this issue 2 years ago • 4 comments

🐛 Bug Report

Incorrect mapping from grpc code to http code for canceled request.

The reference for error mapping in HTTPStatusFromCode is followed from: https://github.com/googleapis/googleapis/blob/942691f8dcf3e521be35d909de9bba3239feb471/google/rpc/code.proto#L40 And the reference claims that http code mapping for CANCELLED grpc code is 499 (Client Closed Request), and not 408 (StatusRequestTimeout).

To Reproduce

Implement the HTTPStatusFromCode method from the runtime pkg, and see the incorrect mapping for Canceled GRPC code.

Expected behavior

GRPC Canceled code must be mapped to http code 499 (Client Closed Request), instead of 408 (StatusRequestTimeout).

Actual Behavior

GRPC Canceled code maps to http 408 (StatusRequestTimeout).

brijeshvishwanath avatar May 23 '22 11:05 brijeshvishwanath

Huh, I could've sworn I went and checked these. Thank you for your issue and the PR!

johanbrandhorst avatar May 23 '22 22:05 johanbrandhorst

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 31 '22 06:07 stale[bot]

I would like to contribute to fix this issue. Thank you!!

Rajarshi1998 avatar Sep 09 '22 20:09 Rajarshi1998

Hi, please feel free to open a new PR, we haven't heard anything from @brijeshvishwanath for a while.

johanbrandhorst avatar Sep 09 '22 20:09 johanbrandhorst

humm, .NET doesn't support 499 status code. Thread with discussion here 🧵 https://github.com/dotnet/aspnetcore/issues/41475

dbeylkhanov avatar Oct 05 '22 11:10 dbeylkhanov

Non-standard or not, we should be consistent with the code.proto definitions in our error conversions. I still think we want this change.

johanbrandhorst avatar Oct 12 '22 03:10 johanbrandhorst

Hi @johanbrandhorst, Created PR to contribute this fix, please check.

tech-sumit avatar Oct 17 '22 20:10 tech-sumit