Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change(grpc): add the correspondence between grpc code and http code #7419

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions apisix/plugins/grpc-transcode.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,22 @@ local schema = {
}

local status_rel = {
["3"] = 400,
["4"] = 504,
["5"] = 404,
["7"] = 403,
["11"] = 416,
["12"] = 501,
["13"] = 500,
["14"] = 503,
["1"] = 499, -- CANCELLED
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add the source link as a comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

["2"] = 500, -- UNKNOWN
["3"] = 400, -- INVALID_ARGUMENT
["4"] = 504, -- DEADLINE_EXCEEDED
["5"] = 404, -- NOT_FOUND
["6"] = 409, -- ALREADY_EXISTS
["7"] = 403, -- PERMISSION_DENIED
["8"] = 429, -- RESOURCE_EXHAUSTED
["9"] = 400, -- FAILED_PRECONDITION
["10"] = 409, -- ABORTED
["11"] = 400, -- OUT_OF_RANGE
["12"] = 501, -- UNIMPLEMENTED
["13"] = 500, -- INTERNAL
["14"] = 503, -- UNAVAILABLE
["15"] = 500, -- DATA_LOSS
["16"] = 401, -- UNAUTHENTICATED
}

local _M = {
Expand Down