servemux

package
Version: v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL