matcher

package
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnyRequest

func AnyRequest() web.RequestMatcher

func AnyRoute

func AnyRoute() web.RouteMatcher

func CustomMatcher

func CustomMatcher(description string, matchable matchableFunc, delegate matcher.Matcher) web.RequestMatcher

func NoneRequest

func NoneRequest() web.RequestMatcher

func NotRequest

func NotRequest(m web.RequestMatcher) web.RequestMatcher

func PatternFromURL

func PatternFromURL(relativeUrl string) string

PatternFromURL convert relative URL to pattern by necessary operations, such as remove #fragment portion

func RequestHasForm

func RequestHasForm(param string) web.RequestMatcher

RequestHasForm matches http.Request that have non-empty value with given parameter in query or post body

func RequestHasHeader

func RequestHasHeader(name string) web.RequestMatcher

func RequestHasPostForm

func RequestHasPostForm(param string) web.RequestMatcher

RequestHasPostForm matches http.Request that have non-empty value with given parameter in query or post body

func RequestWithForm

func RequestWithForm(param, value string) web.RequestMatcher

RequestWithForm matches http.Request that have matching param-value pair in query or post body

func RequestWithHeader

func RequestWithHeader(name string, value string, prefix bool) web.RequestMatcher

func RequestWithHost

func RequestWithHost(expected string) web.RequestMatcher

RequestWithHost TODO support wildcard

func RequestWithMethods

func RequestWithMethods(methods ...string) web.RequestMatcher

func RequestWithPattern

func RequestWithPattern(pattern string, methods ...string) web.RequestMatcher

RequestWithPattern create a web.RequestMatcher with path pattern. if context is available when performing the match, the context path is striped

func RequestWithPrefix

func RequestWithPrefix(prefix string, methods ...string) web.RequestMatcher

RequestWithPrefix create a web.RequestMatcher with prefix if context is available when performing the match, the context path is striped

func RequestWithRegex

func RequestWithRegex(regex string, methods ...string) web.RequestMatcher

RequestWithRegex create a web.RequestMatcher with regular expression if context is available when performing the match, the context path is striped

func RequestWithURL

func RequestWithURL(url string, methods ...string) web.RouteMatcher

RequestWithURL is similar with RequestWithPattern, but instead it takes a relative URL path and convert it to pattern by extracting "path" part (remove #fragment, ?query and more)

func RouteWithGroup

func RouteWithGroup(group string) web.RouteMatcher

func RouteWithMethods

func RouteWithMethods(methods ...string) web.RouteMatcher

func RouteWithPattern

func RouteWithPattern(pattern string, methods ...string) web.RouteMatcher

RouteWithPattern checks web.Route's path with prefix The prefix syntax is:

prefix:
  { term }
term:
  '*'         matches any sequence of non-path-separators
  '**'        matches any sequence of characters, including
              path separators.
  '?'         matches any single non-path-separator character
  '[' [ '^' ] { character-range } ']'
        character class (must be non-empty)
  '{' { term } [ ',' { term } ... ] '}'
  c           matches character c (c != '*', '?', '\\', '[')
  '\\' c      matches character c

character-range:
  c           matches character c (c != '\\', '-', ']')
  '\\' c      matches character c
  lo '-' hi   matches character c for lo <= c <= hi

func RouteWithPrefix

func RouteWithPrefix(prefix string, methods ...string) web.RouteMatcher

func RouteWithRegex

func RouteWithRegex(regex string, methods ...string) web.RouteMatcher

func RouteWithURL

func RouteWithURL(url string, methods ...string) web.RouteMatcher

RouteWithURL is similar with RouteWithPattern, but instead it takes a relative URL path and convert it to pattern by extracting "path" part (remove #fragment, ?query and more)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL