Exemple #1
0
func (r *Router) Match(ctx *context.Context) (h handler.HandlerInterface, f bool) {
	var ng = map[string]string{}
	if r.regexp {
		var match bool
		ng, match = utils.NamedRegexpGroup(ctx.Request.URL.Path, r.regexPattern)
		if !match {
			return
		}
		ctx.AddParams(ng)
	} else {
		if ctx.Request.URL.Path != r.pattern {
			return
		}
	}
	f = true
	h = r.handler
	return
}