http

package
v0.0.0-...-fab57c2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package http provides a mockable wrapper for net/http.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Impl

type Impl struct{}

func (*Impl) AllowQuerySemicolons

func (*Impl) AllowQuerySemicolons(h http.Handler) http.Handler

func (*Impl) CanonicalHeaderKey

func (*Impl) CanonicalHeaderKey(s string) string

func (*Impl) DetectContentType

func (*Impl) DetectContentType(data []byte) string

func (*Impl) Error

func (*Impl) Error(w http.ResponseWriter, error string, code int)

func (*Impl) FS

func (*Impl) FS(fsys fs.FS) http.FileSystem

func (*Impl) FileServer

func (*Impl) FileServer(root http.FileSystem) http.Handler

func (*Impl) Get

func (*Impl) Get(url string) (resp *http.Response, err error)

func (*Impl) Handle

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

func (*Impl) HandleFunc

func (*Impl) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))

func (*Impl) Head

func (*Impl) Head(url string) (resp *http.Response, err error)

func (*Impl) ListenAndServe

func (*Impl) ListenAndServe(addr string, handler http.Handler) error

func (*Impl) ListenAndServeTLS

func (*Impl) ListenAndServeTLS(addr string, certFile string, keyFile string, handler http.Handler) error

func (*Impl) MaxBytesHandler

func (*Impl) MaxBytesHandler(h http.Handler, n int64) http.Handler

func (*Impl) MaxBytesReader

func (*Impl) MaxBytesReader(w http.ResponseWriter, r io.ReadCloser, n int64) io.ReadCloser

func (*Impl) NewFileTransport

func (*Impl) NewFileTransport(fs http.FileSystem) http.RoundTripper

func (*Impl) NewRequest

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

func (*Impl) NewRequestWithContext

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

func (*Impl) NewServeMux

func (*Impl) NewServeMux() *http.ServeMux

func (*Impl) NotFound

func (*Impl) NotFound(w http.ResponseWriter, r *http.Request)

func (*Impl) NotFoundHandler

func (*Impl) NotFoundHandler() http.Handler

func (*Impl) ParseHTTPVersion

func (*Impl) ParseHTTPVersion(vers string) (major int, minor int, ok bool)

func (*Impl) ParseTime

func (*Impl) ParseTime(text string) (t time.Time, err error)

func (*Impl) Post

func (*Impl) Post(url string, contentType string, body io.Reader) (resp *http.Response, err error)

func (*Impl) PostForm

func (*Impl) PostForm(url string, data url.Values) (resp *http.Response, err error)

func (*Impl) ProxyFromEnvironment

func (*Impl) ProxyFromEnvironment(req *http.Request) (*url.URL, error)

func (*Impl) ProxyURL

func (*Impl) ProxyURL(fixedURL *url.URL) func(*http.Request) (*url.URL, error)

func (*Impl) ReadRequest

func (*Impl) ReadRequest(b *bufio.Reader) (*http.Request, error)

func (*Impl) ReadResponse

func (*Impl) ReadResponse(r *bufio.Reader, req *http.Request) (*http.Response, error)

func (*Impl) Redirect

func (*Impl) Redirect(w http.ResponseWriter, r *http.Request, url string, code int)

func (*Impl) RedirectHandler

func (*Impl) RedirectHandler(url string, code int) http.Handler

func (*Impl) Serve

func (*Impl) Serve(l net.Listener, handler http.Handler) error

func (*Impl) ServeContent

func (*Impl) ServeContent(w http.ResponseWriter, req *http.Request, name string, modtime time.Time, content io.ReadSeeker)

func (*Impl) ServeFile

func (*Impl) ServeFile(w http.ResponseWriter, r *http.Request, name string)

func (*Impl) ServeTLS

func (*Impl) ServeTLS(l net.Listener, handler http.Handler, certFile string, keyFile string) error

func (*Impl) SetCookie

func (*Impl) SetCookie(w http.ResponseWriter, cookie *http.Cookie)

func (*Impl) StatusText

func (*Impl) StatusText(code int) string

func (*Impl) StripPrefix

func (*Impl) StripPrefix(prefix string, h http.Handler) http.Handler

func (*Impl) TimeoutHandler

func (*Impl) TimeoutHandler(h http.Handler, dt time.Duration, msg string) http.Handler

type Interface

type Interface interface {
	AllowQuerySemicolons(h http.Handler) http.Handler
	CanonicalHeaderKey(s string) string
	DetectContentType(data []byte) string
	Error(w http.ResponseWriter, error string, code int)
	FS(fsys fs.FS) http.FileSystem
	FileServer(root http.FileSystem) http.Handler
	Get(url string) (resp *http.Response, err error)
	Handle(pattern string, handler http.Handler)
	HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
	Head(url string) (resp *http.Response, err error)
	ListenAndServe(addr string, handler http.Handler) error
	ListenAndServeTLS(addr string, certFile string, keyFile string, handler http.Handler) error
	MaxBytesHandler(h http.Handler, n int64) http.Handler
	MaxBytesReader(w http.ResponseWriter, r io.ReadCloser, n int64) io.ReadCloser
	NewFileTransport(fs http.FileSystem) http.RoundTripper
	NewRequest(method string, url string, body io.Reader) (*http.Request, error)
	NewRequestWithContext(ctx context.Context, method string, url string, body io.Reader) (*http.Request, error)
	NewServeMux() *http.ServeMux
	NotFound(w http.ResponseWriter, r *http.Request)
	NotFoundHandler() http.Handler
	ParseHTTPVersion(vers string) (major int, minor int, ok bool)
	ParseTime(text string) (t time.Time, err error)
	Post(url string, contentType string, body io.Reader) (resp *http.Response, err error)
	PostForm(url string, data url.Values) (resp *http.Response, err error)
	ProxyFromEnvironment(req *http.Request) (*url.URL, error)
	ProxyURL(fixedURL *url.URL) func(*http.Request) (*url.URL, error)
	ReadRequest(b *bufio.Reader) (*http.Request, error)
	ReadResponse(r *bufio.Reader, req *http.Request) (*http.Response, error)
	Redirect(w http.ResponseWriter, r *http.Request, url string, code int)
	RedirectHandler(url string, code int) http.Handler
	Serve(l net.Listener, handler http.Handler) error
	ServeContent(w http.ResponseWriter, req *http.Request, name string, modtime time.Time, content io.ReadSeeker)
	ServeFile(w http.ResponseWriter, r *http.Request, name string)
	ServeTLS(l net.Listener, handler http.Handler, certFile string, keyFile string) error
	SetCookie(w http.ResponseWriter, cookie *http.Cookie)
	StatusText(code int) string
	StripPrefix(prefix string, h http.Handler) http.Handler
	TimeoutHandler(h http.Handler, dt time.Duration, msg string) http.Handler
}

Directories

Path Synopsis
Package cgi provides a mockable wrapper for net/http/cgi.
Package cgi provides a mockable wrapper for net/http/cgi.
Package cookiejar provides a mockable wrapper for net/http/cookiejar.
Package cookiejar provides a mockable wrapper for net/http/cookiejar.
Package fcgi provides a mockable wrapper for net/http/fcgi.
Package fcgi provides a mockable wrapper for net/http/fcgi.
Package httptest provides a mockable wrapper for net/http/httptest.
Package httptest provides a mockable wrapper for net/http/httptest.
Package httptrace provides a mockable wrapper for net/http/httptrace.
Package httptrace provides a mockable wrapper for net/http/httptrace.
Package httputil provides a mockable wrapper for net/http/httputil.
Package httputil provides a mockable wrapper for net/http/httputil.
Package pprof provides a mockable wrapper for net/http/pprof.
Package pprof provides a mockable wrapper for net/http/pprof.

Jump to

Keyboard shortcuts

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