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

(Combined)LoggingHandler: Add Go 1.8 http.Pusher support #97

Merged
merged 2 commits into from
Feb 9, 2017

Conversation

nwidger
Copy link
Contributor

@nwidger nwidger commented Feb 9, 2017

When building with Go 1.8, embed http.Pusher interface in
loggingResponseWriter interface and define a Push wrapper method on
responseLogger. Without this change, users of handlers.LoggingHandler
or handlers.CombinedLoggingHandler cannot take advantage of the new
http.Pusher interface.

When building with pre-1.8 Go, the loggingResponseWriter and
responseLogger types remain unchanged.

When building with Go 1.8, embed http.Pusher interface in
loggingResponseWriter interface and define a Push wrapper method on
responseLogger.  Without this change, users of handlers.LoggingHandler
or handlers.CombinedLoggingHandler cannot take advantage of the new
http.Pusher interface since responseLogger does not satisfy the
http.Pusher interface.

When building with pre-1.8 Go, the loggingResponseWriter and
responseLogger types remain unchanged.
@kisielk
Copy link
Contributor

kisielk commented Feb 9, 2017

Can you add a test for this?

Added two tests TestLoggingHandlerWithPush and
TestCombinedLoggingHandlerWithPush in new handlers_go18_test.go file
which is only built with Go 1.8 or higher.  Tests ensure that the
ResponseWriter passed to a handler wrapped with
handlers.LoggingHandler or handlers.CombinedLoggingHandler satisfy the
new http.Pusher interface.
@nwidger
Copy link
Contributor Author

nwidger commented Feb 9, 2017

I added a couple tests, let me know if you need anything more in depth.

@kisielk kisielk merged commit 6d39a51 into gorilla:master Feb 9, 2017
@kisielk
Copy link
Contributor

kisielk commented Feb 9, 2017

Thanks!

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.

None yet

2 participants