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: types related to message body should be bytes #132

Merged
merged 5 commits into from
Dec 7, 2022
Merged

Conversation

StarlightIbuki
Copy link
Contributor

@StarlightIbuki StarlightIbuki commented Oct 19, 2022

Rerun test after merging Kong/kong#9526

Fix Kong/kong#9294

@@ -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) {
Copy link
Contributor

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.

Copy link
Contributor Author

@StarlightIbuki StarlightIbuki Oct 24, 2022

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.

@fffonion fffonion merged commit 4deec45 into master Dec 7, 2022
@fffonion fffonion deleted the fix/ret_type branch December 7, 2022 08:45
@DingGGu
Copy link

DingGGu commented Dec 8, 2022

#126

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ExitArgs.Body should be []byte instead of string
4 participants