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

feat: implement flush() #90

Merged
merged 2 commits into from
Nov 8, 2022
Merged

feat: implement flush() #90

merged 2 commits into from
Nov 8, 2022

Conversation

dunglas
Copy link
Owner

@dunglas dunglas commented Nov 7, 2022

Closes #11.

To test it: curl --no-buffer http://localhost/flush.php

This was referenced Nov 7, 2022
Copy link
Collaborator

@withinboredom withinboredom left a comment

Choose a reason for hiding this comment

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

Works as advertised

var j int

req := httptest.NewRequest("GET", fmt.Sprintf("http://example.com/flush.php?i=%d", i), nil)
w := &streamResponseRecorder{httptest.NewRecorder(), func(buf []byte) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Clever! I assume the i variable is to ensure the response is sent to the correct client?

Copy link
Owner Author

Choose a reason for hiding this comment

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

exactly

@dunglas dunglas merged commit 8e136d0 into main Nov 8, 2022
@dunglas dunglas deleted the feat/implement-flush branch November 8, 2022 23:56
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.

2 participants