Skip to content

Commit

Permalink
Merge pull request #9 from apache/master
Browse files Browse the repository at this point in the history
test case for grpc transcode pb option (apache#920)
  • Loading branch information
lilien1010 authored Dec 2, 2019
2 parents be2ec59 + 4517e7b commit 4643089
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion doc/plugins/grpc-transcoding-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]


### 示例
Expand Down
19 changes: 15 additions & 4 deletions t/plugin/grpc-transcode.t
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}"
}]]
)
Expand Down Expand Up @@ -279,7 +279,8 @@ passed
"grpc-transcode": {
"proto_id": "1",
"service": "helloworld.Greeter",
"method": "Plus"
"method": "Plus",
"pb_option":["int64_as_string"]
}
},
"upstream": {
Expand Down Expand Up @@ -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]

0 comments on commit 4643089

Please sign in to comment.