Documentation
¶
Index ¶
- Variables
- func GetBody(r *http.Request) any
- func GetCtxBody(r *http.Request) any
- func GetCtxQueryParameters(r *http.Request) map[string][]string
- func GetCtxWildcards(r *http.Request) map[string]string
- func GetQueryParameters(r *http.Request) map[string][]string
- func GetWildcards(r *http.Request) map[string]string
- func SetBody(r *http.Request, body any) *http.Request
- func SetCtxBody(r *http.Request, body any) *http.Request
- func SetCtxQueryParameters(r *http.Request, parameters map[string][]string) *http.Request
- func SetCtxWildcards(r *http.Request, wildcards map[string]string) *http.Request
- func SetQueryParameters(r *http.Request, parameters map[string][]string) *http.Request
- func SetWildcards(r *http.Request, wildcards map[string]string) *http.Request
- type ContextKey
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrMissingBodyInContext = errors.New("missing body in context")
)
Functions ¶
func GetCtxBody ¶
GetCtxBody tries to get the body from the context
Parameters:
- r: The HTTP request
Returns:
- any: The body from the context, or nil if not found
func GetCtxQueryParameters ¶ added in v0.11.2
GetCtxQueryParameters tries to get the query parameters from the context
Parameters:
- r: The HTTP request
Returns:
- map[string][]string: The query parameters from the context, or nil if not found
func GetCtxWildcards ¶ added in v0.11.2
GetCtxWildcards tries to get the wildcards from the context
Parameters:
- r: The HTTP request
Returns:
- map[string]string: The wildcards from the context, or nil if not found
func GetQueryParameters ¶ added in v0.11.2
GetQueryParameters wraps GetCtxQueryParameters
func GetWildcards ¶ added in v0.11.2
GetWildcards wraps GetCtxWildcards
func SetCtxBody ¶
SetCtxBody sets the body in the context
Parameters:
- r: The HTTP request
- body: The body to set in the context
Returns:
- *http.Request: The HTTP request with the body set in the context
func SetCtxQueryParameters ¶ added in v0.11.2
SetCtxQueryParameters sets the query parameters in the context
Parameters:
- r: The HTTP request
- parameters: The query parameters to set in the context
Returns:
- *http.Request: The HTTP request with the query parameters set in the context
func SetCtxWildcards ¶ added in v0.11.2
SetCtxWildcards sets the wildcards in the context
Parameters:
- r: The HTTP request
- wildcards: The wildcards to set in the context
Returns:
- *http.Request: The HTTP request with the wildcards set in the context
func SetQueryParameters ¶ added in v0.11.2
SetQueryParameters wraps SetCtxQueryParameters
Types ¶
type ContextKey ¶ added in v0.12.7
type ContextKey string
ContextKey is the type for context keys
const ( // CtxBodyKey is the context key for the body CtxBodyKey ContextKey = "body" // CtxQueryParametersKey is the context key for the query parameters CtxQueryParametersKey ContextKey = "query_parameters" // CtxWildcardsKey is the context key for the wildcard CtxWildcardsKey ContextKey = "wildcards" )
Click to show internal directories.
Click to hide internal directories.