24 lines
421 B
Go
24 lines
421 B
Go
package server
|
|
|
|
import (
|
|
"bufio"
|
|
"net"
|
|
"net/http"
|
|
)
|
|
|
|
type logResponseWriter struct {
|
|
http.ResponseWriter
|
|
status int
|
|
}
|
|
|
|
func (w *logResponseWriter) WriteHeader(status int) {
|
|
w.status = status
|
|
w.ResponseWriter.WriteHeader(status)
|
|
}
|
|
|
|
func (w *logResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
|
|
hj, _ := w.ResponseWriter.(http.Hijacker)
|
|
w.status = http.StatusSwitchingProtocols
|
|
return hj.Hijack()
|
|
}
|