handy
handy copied to clipboard
report.JSON breaks websockets
If you wrap your websocket Handler in report.JSON
you end up with something like this:
2017/01/10 14:15:43 websocket: response does not implement http.Hijacker
@ohookins: That's quite common problem, not only present in handy but in most libs wrapping various "upgradable" interfaces. Here's a good read about upgradeable interfaces, the problems they solve and the ones they bring: https://avtok.com/2014/11/05/interface-upgrades.html
This PR solves it for gzipWriter
. But there are more interfaces which ResponseWriter
can be upgraded to...
@telendt I guess that's just a simpler version of this: https://github.com/prometheus/client_golang/blob/master/prometheus/http.go#L296-L306
@streadway are you ok with me making a PR for report along the lines of #28 ? Or perhaps @telendt is kind enough to add report to the same PR...
Go for it. There are a few more interfaces to implement as well for http/2 support.