Skip to content

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

Merged
kisielk merged 2 commits intogorilla:masterfrom
nwidger:master
Feb 9, 2017
Merged

(Combined)LoggingHandler: Add Go 1.8 http.Pusher support#97
kisielk merged 2 commits intogorilla:masterfrom
nwidger:master

Conversation

@nwidger
Copy link

@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
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.

2 participants