httputil

package
v2.25.0-snrc.5 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

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-site 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