httputil

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2025 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrHijackUnsupported = errors.New("the ResponseWriter doesn't support the Hijacker interface")
)

Functions

func Chain

func Chain(h http.Handler, ff ...func(http.Handler) http.Handler) http.Handler

Chain applies middlewares to a http.Handler

func ChainFunc

func ChainFunc(hf http.HandlerFunc, ff ...func(http.HandlerFunc) http.HandlerFunc) http.HandlerFunc

ChainFunc applies middlewares to a http.HandlerFunc

func MethodOverride

func MethodOverride(h http.Handler) http.Handler

MethodOverride is a higher order [http.handlerFunc] which allows the client to override a POST request with a PUT, PATCH or DELETE.

A search query ("_method") can be used or header ("X-HTTP-Method-Override").

Types

type ResponseWriter

type ResponseWriter interface {
	http.ResponseWriter
	http.Flusher
	// Status returns the status code of the response or 0 if the response has not been written.
	Status() int
	// Written returns whether or not the ResponseWriter has been written.
	Written() bool
	// Size returns the size of the response body.
	Size() int
	Unwrap() http.ResponseWriter
	// Tee allows the caller to write to multiple writers.
	Tee(w io.Writer)
}

func Wrap

Wrap http.ResponseWriter into a ResponseWriter.

Jump to

Keyboard shortcuts

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