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

http.Flusher implementation #215

Closed
System-Glitch opened this issue Jul 3, 2024 · 0 comments · Fixed by #218
Closed

http.Flusher implementation #215

System-Glitch opened this issue Jul 3, 2024 · 0 comments · Fixed by #218
Assignees
Labels
enhancement Enhancement of existing feature

Comments

@System-Glitch
Copy link
Member

System-Glitch commented Jul 3, 2024

Proposal

*goyave.Response and built-in chained writers don't implement http.Flusher. This makes it difficult for streamed responses for example. Having more options is always a good thing.

We would need to be cautious implementing this in regards to the compression middleware. We'd have to make encoders still work properly when flushing.

Additional suggestion: chained writers are becoming more verbose because of the need to support multiple interfaces such as goyave.PreWriter, io.Closer and now http.Flusher. It would be a convenient improvement to provide a BaseWriter (or CommonWriter) to use with composition and that implements a proper default behavior for all these interfaces.

Chained writers docs.

@System-Glitch System-Glitch added the enhancement Enhancement of existing feature label Jul 3, 2024
@System-Glitch System-Glitch self-assigned this Jul 12, 2024
System-Glitch added a commit that referenced this issue Jul 12, 2024
- Response implement http.Flusher
- Call PreWrite only once on the first Write
- Add CommonWriter to reduce chained writers boilerplate
- Use CommonWriter for log and compress middleware
System-Glitch added a commit that referenced this issue Jul 12, 2024
- Response implement http.Flusher
- Call PreWrite only once on the first Write
- Add CommonWriter to reduce chained writers boilerplate
- Use CommonWriter for log and compress middleware
System-Glitch added a commit that referenced this issue Jul 12, 2024
- Response implement http.Flusher
- Call PreWrite only once on the first Write
- Add CommonWriter to reduce chained writers boilerplate
- Use CommonWriter for log and compress middleware
System-Glitch added a commit that referenced this issue Jul 15, 2024
- Response implement http.Flusher
- Call PreWrite only once on the first Write
- Add CommonWriter to reduce chained writers boilerplate
- Use CommonWriter for log and compress middleware
System-Glitch added a commit that referenced this issue Jul 23, 2024
Response: add support for flushing #215

- Response implement http.Flusher
- Add goyave.Flusher interface
- Call PreWrite only once on the first Write
- Add CommonWriter to reduce chained writers boilerplate
- Use CommonWriter for log and compress middleware
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement of existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant