router: added middlewares

This commit is contained in:
2026-02-02 17:26:45 +02:00
parent c973fccc86
commit 0dac88fde8
5 changed files with 113 additions and 2 deletions
+2
View File
@@ -11,6 +11,7 @@ type Context struct {
Request *http.Request
Writer http.ResponseWriter
PathMap map[string]string
StatusCode int
}
func NewContext(writer http.ResponseWriter, request *http.Request) *Context {
@@ -29,6 +30,7 @@ func (rctx *Context) SetHeader(key, value string) {
}
func (rctx *Context) SetStatus(httpStatus int) {
rctx.StatusCode = httpStatus
rctx.Writer.WriteHeader(httpStatus)
}