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

fix(pdk): response.exit accept bytes #9526

Merged
merged 3 commits into from
Oct 24, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@
(`kong.request.getUriCaptures`)
[#9512](https://github.com/Kong/kong/pull/9512)

- Fixed parameter type of `kong.service.request.set_raw_body`
(`kong.service.request.setRawBody`), return type of
StarlightIbuki marked this conversation as resolved.
Show resolved Hide resolved
`kong.service.response.get_raw_body`(`kong.service.request.getRawBody`),
and body parameter type of `kong.response.exit` to bytes. Note that old
version of go PDK is incompatible after this change.
[#9526](https://github.com/Kong/kong/pull/9526)

#### Plugins

- **AWS Lambda**: Fix an issue that is causing inability to
Expand Down
10 changes: 7 additions & 3 deletions kong/include/kong/pluginsocket.proto
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,13 @@ message String {
string v = 1;
}

message ByteString {
bytes v = 1;
}

message ExitArgs {
int32 status = 1;
string body = 2;
bytes body = 2;
google.protobuf.Struct headers = 3;
StarlightIbuki marked this conversation as resolved.
Show resolved Hide resolved
}

Expand Down Expand Up @@ -336,10 +340,10 @@ service Kong {
rpc Service_Request_AddHeader(KV) returns (google.protobuf.Empty);
rpc Service_Request_ClearHeader(String) returns (google.protobuf.Empty);
rpc Service_Request_SetHeaders(google.protobuf.Struct) returns (google.protobuf.Empty);
rpc Service_Request_SetRawBody(String) returns (google.protobuf.Empty);
rpc Service_Request_SetRawBody(ByteString) returns (google.protobuf.Empty);

rpc Service_Response_GetStatus(google.protobuf.Empty) returns (Int);
rpc Service_Response_GetHeader(String) returns (String);
rpc Service_Response_GetHeaders(Int) returns (google.protobuf.Struct);
rpc Service_Response_GetRawBody(google.protobuf.Empty) returns (String);
rpc Service_Response_GetRawBody(google.protobuf.Empty) returns (ByteString);
}
2 changes: 2 additions & 0 deletions kong/runloop/plugin_servers/pb_rpc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ do
[".kong_plugin_protocol.Number"] = unwrap_val,
[".kong_plugin_protocol.Int"] = unwrap_val,
[".kong_plugin_protocol.String"] = unwrap_val,
[".kong_plugin_protocol.ByteString"] = unwrap_val,
[".kong_plugin_protocol.KV"] = function(d)
return d.k, structpb_value(d.v)
end,
Expand Down Expand Up @@ -151,6 +152,7 @@ do
[".kong_plugin_protocol.Number"] = wrap_val,
[".kong_plugin_protocol.Int"] = wrap_val,
[".kong_plugin_protocol.String"] = wrap_val,
[".kong_plugin_protocol.ByteString"] = wrap_val,
[".kong_plugin_protocol.RawBodyResult"] = function(v, err)
if type(v) == "string" then
return { content = v }
Expand Down