mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-18 00:06:38 +00:00
27 lines
557 B
Go
27 lines
557 B
Go
package accesslog
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
// statusWriter is a simple wrapper around an http.ResponseWriter
|
|
// that captures the setting of the status code via the WriteHeader
|
|
// function and stores it so that it can be retrieved later.
|
|
type statusWriter struct {
|
|
w http.ResponseWriter
|
|
status int
|
|
}
|
|
|
|
func (w *statusWriter) Header() http.Header {
|
|
return w.w.Header()
|
|
}
|
|
|
|
func (w *statusWriter) Write(data []byte) (int, error) {
|
|
return w.w.Write(data)
|
|
}
|
|
|
|
func (w *statusWriter) WriteHeader(status int) {
|
|
w.status = status
|
|
w.w.WriteHeader(status)
|
|
}
|