-
Notifications
You must be signed in to change notification settings - Fork 48
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
kong.ServiceResponse.GetRawBody() is not working when trying to retrieve response body #165
Comments
Hi. Could you share the Go PDK version that is used? |
Hi, Meanwhile, the request.GetRawBody function actually returns So I think this is indeed a bug, as go-pdk doesn't provide any way to manipulate the binary body of the response (e.g. gzip) and returns an error |
Internally tracked: KAG-3790 |
Correctly return a byte array instead of string. :warning: BREAKING CHANGE: - This is a needed breaking change to fix the behavior of the method. Your plugins must be updated to correctly handle the new return value type of `[]byte` rather than `string`. Fixes #165.
Correctly return a byte array instead of string. :warning: BREAKING CHANGE: - This is a needed breaking change to fix the behavior of the method. Your plugins must be updated to correctly handle the new return value type of `[]byte` rather than `string`. Fixes #165.
I try to get the response header and body from upstream server by using this code below
The result from logging I can get the header key response but I cannot get the response raw body. This is the error that was printed.
body = err = string field contains invalid UTF-8
I just tried to get the request body by using kong.Request.GetRawBody() as well. It returns an empty byte array but when I try to get the request header everything works fine.
Kong version 3.0.2
Kong config
- KONG_DATABASE=off
- KONG_DECLARATIVE_CONFIG=/usr/local/kong/declarative/kong.yml
- KONG_PLUGINS=bundled,go-plugin
- KONG_PLUGINSERVER_NAMES=go-plugin
- KONG_PLUGINSERVER_GO_PLUGIN_START_CMD=/usr/local/bin/go-plugin
- KONG_PLUGINSERVER_GO_PLUGIN_QUERY_CMD=/usr/local/bin/go-plugin -dump
The text was updated successfully, but these errors were encountered: