mirror of
https://github.com/sorenisanerd/gotty.git
synced 2024-11-09 23:34:26 +00:00
24 lines
412 B
Go
24 lines
412 B
Go
package app
|
|
|
|
import (
|
|
"bufio"
|
|
"net"
|
|
"net/http"
|
|
)
|
|
|
|
type responseWrapper struct {
|
|
http.ResponseWriter
|
|
status int
|
|
}
|
|
|
|
func (w *responseWrapper) WriteHeader(status int) {
|
|
w.status = status
|
|
w.ResponseWriter.WriteHeader(status)
|
|
}
|
|
|
|
func (w *responseWrapper) Hijack() (net.Conn, *bufio.ReadWriter, error) {
|
|
hj, _ := w.ResponseWriter.(http.Hijacker)
|
|
w.status = http.StatusSwitchingProtocols
|
|
return hj.Hijack()
|
|
}
|