Help us shape the future of Go! Take the 2026 Go Developer Survey

httputil

package
v0.313.5 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 9 Imported by: 702

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextFromRequest

func ContextFromRequest(ctx context.Context, r *http.Request) context.Context

ContextFromRequest returns a new context with identifiers of the request to be used later when logging the query.

func ContextWithPath

func ContextWithPath(ctx context.Context, path string) context.Context

ContextWithPath returns a new context with the given path to be used later when logging the query.

func SetCORS

func SetCORS(w http.ResponseWriter, o *regexp.Regexp, r *http.Request)

SetCORS enables cross-origin script calls.

Types

type CompressionHandler

type CompressionHandler struct {
	Handler http.Handler
}

CompressionHandler is a wrapper around http.Handler which adds suitable response compression based on the client's Accept-Encoding headers.

func (CompressionHandler) ServeHTTP

func (c CompressionHandler) ServeHTTP(writer http.ResponseWriter, req *http.Request)

ServeHTTP adds compression to the original http.Handler's ServeHTTP() method.

Jump to

Keyboard shortcuts

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