monkeyDluffy6017 commented on code in PR #7639:
URL: https://github.com/apache/apisix/pull/7639#discussion_r944181561


##########
apisix/plugins/grpc-transcode/response.lua:
##########
@@ -14,18 +14,77 @@
 -- See the License for the specific language governing permissions and
 -- limitations under the License.
 --
-local util   = require("apisix.plugins.grpc-transcode.util")
+local util        = require("apisix.plugins.grpc-transcode.util")
+local grpc_proto  = require("apisix.plugins.grpc-transcode.proto")
 local core   = require("apisix.core")
 local pb     = require("pb")
 local ngx    = ngx
 local string = string
+local ngx_decode_base64 = ngx.decode_base64
+local ipairs = ipairs
+local pcall  = pcall
 
-return function(ctx, proto, service, method, pb_option)
+
+local function handle_error_response(status_detail_type)
+    local headers = ngx.resp.get_headers()
+    local grpc_status = headers["grpc-status-details-bin"]
+    if grpc_status then
+        grpc_status = ngx_decode_base64(grpc_status)
+        if grpc_status == nil then
+            ngx.arg[1] = "grpc-status-details-bin is not base64 format"
+            return "grpc-status-details-bin is not base64 format"
+        end
+
+        local status_pb_state = grpc_proto.fetch_status_pb_state()
+        local old_pb_state = pb.state(status_pb_state)
+
+        local decoded_grpc_status = pb.decode("grpc.status.ErrorStatus", 
grpc_status)

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to