Skip to content
This repository has been archived by the owner on Jul 28, 2024. It is now read-only.

fix: body callbacks return the whole buffered body size #418

Merged
merged 1 commit into from
Dec 23, 2023

Conversation

M4tteoP
Copy link
Member

@M4tteoP M4tteoP commented Dec 22, 2023

Following #414 discussion this PR tries to:

Tentatively closes #414.

e2e/e2e_test.go Outdated Show resolved Hide resolved
@mathetake
Copy link
Member

As I commented, please make sure that each PR has a narrow scope rather than having multiple ones so that we can investigate the history easily later

@M4tteoP
Copy link
Member Author

M4tteoP commented Dec 23, 2023

Thanks, done (and sorry for the hiccup)!

This PR has been restricted to the main topic: emulator and related existing http_body example fix proposal and discussion.

Other PRs created are:

Copy link
Member

@mathetake mathetake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool thanks!

}

// Override types.DefaultHttpContext.
func (ctx *setBodyContext) OnHttpRequestHeaders(numHeaders int, endOfStream bool) types.Action {
mode, err := proxywasm.GetHttpRequestHeader("buffer-replace-at")
if mode == "response" {
if err == nil && mode == "response" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious what's the reason for this check?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

err is retrieved but not used. I was in doubt about whether not even retrieve it, or to ensure it was nil before relying on mode

@mathetake mathetake merged commit 9c1dd2b into tetratelabs:main Dec 23, 2023
14 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OnHttpResponseBody will buffer the whole body when ActionPause returned before
2 participants