Documentation
¶
Index ¶
- Constants
- Variables
- func GetBody(r *http.Request) interface{}
- func GetCtxBody(r *http.Request) interface{}
- 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 interface{}) *http.Request
- func SetCtxBody(r *http.Request, body interface{}) *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
Constants ¶
View Source
const ( // CtxBodyKey is the context key for the body CtxBodyKey = "body" // CtxQueryParametersKey is the context key for the query parameters CtxQueryParametersKey = "query_parameters" // CtxWildcardsKey is the context key for the wildcard CtxWildcardsKey = "wildcards" )
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:
- interface{}: 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 ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.