lmhttp

package
v0.0.0-...-8473fab Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UserAgent = "leatherman/" + version.Version

UserAgent is the canonical UserAgent string for the leatherman.

Functions

func Get

func Get(ctx context.Context, url string) (*http.Response, error)

Get requests the url with http.DefaultClient, using NewRequest

func NewRequest

func NewRequest(ctx context.Context, method, url string, body io.Reader) (*http.Request, error)

NewRequest returns an *http.Request with the UserAgent header properly set.

func TrimHandlerPrefix

func TrimHandlerPrefix(prefix string, h http.Handler) http.Handler

TrimHandlerPrefix adapts handlers to a mux or possibly an alternate subroute. The prefix is stripped from the url path such that the inner handler is unaware of the prefix.

Types

type ClearMux

type ClearMux struct {
	*http.ServeMux
	// contains filtered or unexported fields
}

func NewClearMux

func NewClearMux() *ClearMux

func (*ClearMux) Handle

func (m *ClearMux) Handle(pattern string, handler http.Handler)

type HandlerFunc

type HandlerFunc func(http.ResponseWriter, *http.Request) error

func (HandlerFunc) ServeHTTP

func (f HandlerFunc) ServeHTTP(rw http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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