mux

package
Version: v1.14.6 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2019 License: Apache-2.0, Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package mux contains abstractions for http multiplexing of APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PathRecorderMux

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

PathRecorderMux wraps a mux object and records the registered exposedPaths.

func NewPathRecorderMux

func NewPathRecorderMux(name string) *PathRecorderMux

NewPathRecorderMux creates a new PathRecorderMux

func (*PathRecorderMux) Handle

func (m *PathRecorderMux) Handle(path string, handler http.Handler)

Handle registers the handler for the given pattern. If a handler already exists for pattern, Handle panics.

func (*PathRecorderMux) HandleFunc

func (m *PathRecorderMux) HandleFunc(path string, handler func(http.ResponseWriter, *http.Request))

HandleFunc registers the handler function for the given pattern. If a handler already exists for pattern, Handle panics.

func (*PathRecorderMux) HandlePrefix added in v1.7.0

func (m *PathRecorderMux) HandlePrefix(path string, handler http.Handler)

HandlePrefix is like Handle, but matches for anything under the path. Like a standard golang trailing slash.

func (*PathRecorderMux) ListedPaths added in v1.7.0

func (m *PathRecorderMux) ListedPaths() []string

ListedPaths returns the registered handler exposedPaths.

func (*PathRecorderMux) NotFoundHandler added in v1.7.0

func (m *PathRecorderMux) NotFoundHandler(notFoundHandler http.Handler)

NotFoundHandler sets the handler to use if there's no match for a give path

func (*PathRecorderMux) ServeHTTP added in v1.7.0

func (m *PathRecorderMux) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP makes it an http.Handler

func (*PathRecorderMux) UnlistedHandle added in v1.7.0

func (m *PathRecorderMux) UnlistedHandle(path string, handler http.Handler)

UnlistedHandle registers the handler for the given pattern, but doesn't list it. If a handler already exists for pattern, Handle panics.

func (*PathRecorderMux) UnlistedHandleFunc added in v1.7.0

func (m *PathRecorderMux) UnlistedHandleFunc(path string, handler func(http.ResponseWriter, *http.Request))

UnlistedHandleFunc registers the handler function for the given pattern, but doesn't list it. If a handler already exists for pattern, Handle panics.

func (*PathRecorderMux) UnlistedHandlePrefix added in v1.7.0

func (m *PathRecorderMux) UnlistedHandlePrefix(path string, handler http.Handler)

UnlistedHandlePrefix is like UnlistedHandle, but matches for anything under the path. Like a standard golang trailing slash.

func (*PathRecorderMux) Unregister added in v1.7.0

func (m *PathRecorderMux) Unregister(path string)

Unregister removes a path from the mux.

Jump to

Keyboard shortcuts

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