package servemux

import "github.com/google/martian/v3/servemux"

Package servemux contains a filter that executes modifiers when there is a pattern match in a mux.

Index

Types

type Filter

type Filter struct {
	*filter.Filter
}

Filter is a modifier that executes mod if a pattern is matched in mux.

func NewFilter

func NewFilter(mux *http.ServeMux) *Filter

NewFilter constructs a filter that applies the modifier when the request url matches a pattern in mux. If no mux is provided, the request is evaluated against patterns in http.DefaultServeMux.

type Matcher

type Matcher struct {
	// contains filtered or unexported fields
}

Matcher is a conditional evaluator of request urls against patterns registered in mux.

func NewMatcher

func NewMatcher(mux *http.ServeMux) *Matcher

NewMatcher builds a new servemux.Matcher.

func (*Matcher) MatchRequest

func (m *Matcher) MatchRequest(req *http.Request) bool

MatchRequest returns true if the request URL matches any pattern in mux. If no pattern is matched, false is returned.

func (*Matcher) MatchResponse

func (m *Matcher) MatchResponse(res *http.Response) bool

MatchResponse returns true if the request URL associated with the response matches any pattern in mux. If pattern is matched, false is returned.

Source Files

servemux_filter.go servemux_matcher.go

Version
v3.1.0
Published
Feb 24, 2020
Platform
windows/amd64
Imports
3 packages
Last checked
4 hours ago

Tools for package owners.