-
Notifications
You must be signed in to change notification settings - Fork 50
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: types related to message body should be bytes #132
Conversation
@@ -220,7 +220,7 @@ func (r Response) SetHeaders(headers map[string][]string) error { | |||
// Unless manually specified, this method will automatically set the | |||
// Content-Length header in the produced response for convenience. | |||
|
|||
func (r Response) Exit(status int, body string, headers map[string][]string) { | |||
func (r Response) Exit(status int, body []byte, headers map[string][]string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a breaking change? I know it’s expected to be the bytes type, but someone may rely on the string type already.
Should we confirm that which version should this be?
Or can we make it more smarter: accept a interface and transform string to bytes instead internally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. In this way, we gain the ability to use the new interface but also keep the old code working. But we also have some functions that are returning string
, which we want to change to bytes
. The trick does not work with returning values, and if we only do this to parameters, it will be inconsistent.
We do need to inform users about this breaking change.
Rerun test after merging Kong/kong#9526
Fix Kong/kong#9294