working commit

This commit is contained in:
2026-02-04 18:17:36 +02:00
parent 219a4cb890
commit 55e8abcdd3
6 changed files with 287 additions and 25 deletions
+14 -8
View File
@@ -25,6 +25,7 @@ func NewContext(writer http.ResponseWriter, request *http.Request) *Context {
return rctx
}
// Request
func (rctx *Context) GetSubpath(key string) (string, bool) {
value, exists := rctx.PathMap[key]
return value, exists
@@ -34,6 +35,19 @@ func (rctx *Context) GetQuery(key string) string {
return rctx.Request.URL.Query().Get(key)
}
func (rctx *Context) GetHeader(key string) string {
return rctx.Request.Header.Get(key)
}
func (rctx *Context) GetHeaders() http.Header {
return rctx.Request.Header
}
func (rctx *Context) GetContext() context.Context {
return rctx.Request.Context()
}
// Response
func (rctx *Context) SetHeader(key, value string) {
rctx.Writer.Header().Set(key, value)
}
@@ -52,11 +66,3 @@ func (rctx *Context) SendText(payload string) {
rctx.Writer.Header().Set("Content-Type", "text/plain")
rctx.Writer.Write([]byte(payload))
}
func (rctx *Context) GetHeader(key string) string {
return rctx.Request.Header.Get(key)
}
func (rctx *Context) GetContext() context.Context {
return rctx.Request.Context()
}