created hws module

This commit is contained in:
2026-01-04 00:59:24 +11:00
parent ade3fa0454
commit 14eec74683
12 changed files with 479 additions and 0 deletions

15
hws/responsewriter.go Normal file
View 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
}