created hws module
This commit is contained in:
15
hws/responsewriter.go
Normal file
15
hws/responsewriter.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package hws
|
||||
|
||||
import "net/http"
|
||||
|
||||
// Wraps the http.ResponseWriter, adding a statusCode field
|
||||
type wrappedWriter struct {
|
||||
http.ResponseWriter
|
||||
statusCode int
|
||||
}
|
||||
|
||||
// Extends WriteHeader to the ResponseWriter to add the status code
|
||||
func (w *wrappedWriter) WriteHeader(statusCode int) {
|
||||
w.ResponseWriter.WriteHeader(statusCode)
|
||||
w.statusCode = statusCode
|
||||
}
|
||||
Reference in New Issue
Block a user