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