Skip to content

v0.3.4

Compare
Choose a tag to compare
@maddalax maddalax released this 09 Oct 15:42
· 258 commits to master since this release

What's Changed

  1. Update watcher to include newly added directories
  2. Fix GetPartialPath 404ing if calling it from a nested route (#17) thanks @Pitasi
  3. 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