mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-12-17 20:17:50 +08:00
22 lines
403 B
Go
22 lines
403 B
Go
|
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()
|
||
|
}
|