From 4517e7b57eb074b2e39dc2834486e32ba47d7e45 Mon Sep 17 00:00:00 2001 From: nic-chen <33000667+nic-chen@users.noreply.github.com> Date: Mon, 2 Dec 2019 10:46:13 +0800 Subject: [PATCH] test case for grpc transcode pb option (#920) --- doc/plugins/grpc-transcoding-cn.md | 2 +- t/plugin/grpc-transcode.t | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/doc/plugins/grpc-transcoding-cn.md b/doc/plugins/grpc-transcoding-cn.md index f95b44884605..83d80801a07c 100644 --- a/doc/plugins/grpc-transcoding-cn.md +++ b/doc/plugins/grpc-transcoding-cn.md @@ -53,7 +53,7 @@ curl http://127.0.0.1:9080/apisix/admin/proto/1 -X PUT -d ' * `proto_id`: `.proto`内容的id. * `service`: grpc服务名. * `method`: grpc服务中要调用的方法名. -* `option`: proto 编码过程中的转换选项. [ "int64_as_string" / "enum_as_value" / "auto_default_values" / "enable_hooks" ] +* `pb_option`: proto 编码过程中的转换选项. [ "int64_as_string" / "enum_as_value" / "auto_default_values" / "enable_hooks" ] ### 示例 diff --git a/t/plugin/grpc-transcode.t b/t/plugin/grpc-transcode.t index 282b68e72aa9..08c6504af85d 100644 --- a/t/plugin/grpc-transcode.t +++ b/t/plugin/grpc-transcode.t @@ -240,11 +240,11 @@ Connection refused) while connecting to upstream string message = 1; } message PlusRequest { - int32 a = 1; - int32 b = 2; + int64 a = 1; + int64 b = 2; } message PlusReply { - int32 result = 1; + int64 result = 1; }" }]] ) @@ -279,7 +279,8 @@ passed "grpc-transcode": { "proto_id": "1", "service": "helloworld.Greeter", - "method": "Plus" + "method": "Plus", + "pb_option":["int64_as_string"] } }, "upstream": { @@ -313,3 +314,13 @@ GET /grpc_plus?a=1&b=2 qr/\{"result":3\}/ --- no_error_log [error] + + + +=== TEST 11: hit route +--- request +GET /grpc_plus?a=1&b=2251799813685260 +--- response_body eval +qr/\{"result":"#2251799813685261"\}/ +--- no_error_log +[error]