v0.3.4
What's Changed
- Update watcher to include newly added directories
- Fix GetPartialPath 404ing if calling it from a nested route (#17) thanks @Pitasi
- Add a few utility methods to h.RequestContext
func (c *RequestContext) FormValue(key string)
func (c *RequestContext) Header(key string)
func (c *RequestContext) UrlParam(key string)
func (c *RequestContext) QueryParam(key string)
func (c *RequestContext) IsBoosted() bool
func (c *RequestContext) IsHxRequest() bool
func (c *RequestContext) HxPromptResponse()
func (c *RequestContext) HxTargetId()
func (c *RequestContext) HxTriggerName()
func (c *RequestContext) HxTriggerId()
func (c *RequestContext) HxCurrentBrowserUrl()
Also added
func GetRequestContext(r *http.Request) *RequestContext {
return r.Context().Value(RequestContextKey).(*RequestContext)
}
Usage:
app.Router.Get("/test", func(writer http.ResponseWriter, request *http.Request) {
ctx := h.GetRequestContext(request)
})
For if you need to get the h.RequestContext from an http.Request. This is useful if you are doing your own routing but still want to use h.RequestContext to pass to other things such as partials or other pages.
Full Changelog: v0.3.3...v0.3.4