Add GetHeaderValue, as well as req/res getters
This commit is contained in:
@@ -33,12 +33,15 @@ type HtmxContext interface {
|
|||||||
SetPathTemplate(pathTemplate string)
|
SetPathTemplate(pathTemplate string)
|
||||||
GetPathParam(key string, defaultValue ...string) string
|
GetPathParam(key string, defaultValue ...string) string
|
||||||
GetFormValue(key string) string
|
GetFormValue(key string) string
|
||||||
|
GetHeaderValue(key string) string
|
||||||
SetHeader(key string, value string)
|
SetHeader(key string, value string)
|
||||||
SetAllRoutes(routes []HtmxRoute)
|
SetAllRoutes(routes []HtmxRoute)
|
||||||
GetAllRoutes() []HtmxRoute
|
GetAllRoutes() []HtmxRoute
|
||||||
GetQueryParams() []HtmxPathParam
|
GetQueryParams() []HtmxPathParam
|
||||||
GetAuthContext() (bool, AuthContext)
|
GetAuthContext() (bool, AuthContext)
|
||||||
GetGoContext() context.Context
|
GetGoContext() context.Context
|
||||||
|
GetRequest() *http.Request
|
||||||
|
GetResponseWriter() http.ResponseWriter
|
||||||
}
|
}
|
||||||
|
|
||||||
type HtmxContextImpl struct {
|
type HtmxContextImpl struct {
|
||||||
@@ -50,6 +53,18 @@ type HtmxContextImpl struct {
|
|||||||
routes []HtmxRoute
|
routes []HtmxRoute
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *HtmxContextImpl) GetResponseWriter() http.ResponseWriter {
|
||||||
|
return c.res
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *HtmxContextImpl) GetRequest() *http.Request {
|
||||||
|
return c.req
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *HtmxContextImpl) GetHeaderValue(key string) string {
|
||||||
|
return c.req.Header.Get(key)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *HtmxContextImpl) GetGoContext() context.Context {
|
func (c *HtmxContextImpl) GetGoContext() context.Context {
|
||||||
return c.req.Context()
|
return c.req.Context()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user