middleware

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HeadersFromContext

func HeadersFromContext(ctx context.Context) http.Header

HeadersFromContext retrieves HTTP headers from the given context. It takes a single parameter ctx of type context.Context. It returns an http.Header containing the headers if present in the context, or nil if the context is nil or does not contain headers.

func NewHeadersMiddleware

func NewHeadersMiddleware() func(next http.Handler) http.Handler

NewHeadersMiddleware creates a middleware that injects request headers into the request context. It returns a function that takes an http.Handler and returns an http.Handler. This middleware allows subsequent handlers to access the request headers from the context.

func NewQueryParamsMiddleware

func NewQueryParamsMiddleware() func(next http.Handler) http.Handler

NewQueryParamsMiddleware creates a middleware that extracts query parameters from the URL and stores them in the request context. It returns a function that takes an http.Handler and returns an http.Handler. This middleware allows subsequent handlers to access query parameters via the request context.

func QueryParamsFromContext

func QueryParamsFromContext(ctx context.Context) url.Values

QueryParamsFromContext retrieves URL query parameters from the given context. It takes a single parameter ctx of type context.Context. It returns url.Values containing the query parameters if present, or nil if the context is nil or does not contain query parameters.

Types

This section is empty.

Jump to

Keyboard shortcuts

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