gotty/server/log_response_writer.go

24 lines
421 B
Go
Raw Normal View History

2017-02-25 22:37:07 +00:00
package server
import (
"bufio"
"net"
"net/http"
)
2017-02-25 22:37:07 +00:00
type logResponseWriter struct {
http.ResponseWriter
status int
}
2017-02-25 22:37:07 +00:00
func (w *logResponseWriter) WriteHeader(status int) {
w.status = status
w.ResponseWriter.WriteHeader(status)
}
2017-02-25 22:37:07 +00:00
func (w *logResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
hj, _ := w.ResponseWriter.(http.Hijacker)
w.status = http.StatusSwitchingProtocols
return hj.Hijack()
}