You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
403 B
21 lines
403 B
package stats
|
|
|
|
import "net/http"
|
|
|
|
type StatusRecorder struct {
|
|
http.ResponseWriter
|
|
Status int
|
|
}
|
|
|
|
func NewStatusResponseWriter(w http.ResponseWriter) *StatusRecorder {
|
|
return &StatusRecorder{w, http.StatusOK}
|
|
}
|
|
|
|
func (r *StatusRecorder) WriteHeader(status int) {
|
|
r.Status = status
|
|
r.ResponseWriter.WriteHeader(status)
|
|
}
|
|
|
|
func (r *StatusRecorder) Flush() {
|
|
r.ResponseWriter.(http.Flusher).Flush()
|
|
}
|