Documentation
¶
Overview ¶
Package params implements a decoder of HTTP parameters from the query string, path parameters and request body into a struct.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder decodes request parameters into a struct and validates the values if the struct implements Validator. It uses strict decoding, where unknown fields and unexpected data raises errors.
The Decoder is safe for concurrent use. Use the "schema" struct tag for form decoding (including query string values), "json" for JSON unmarshaling, "path" to decode path values, and "cookie" to decode a cookie value into a field. Both the "schema" and "json" tags will assign to a field without any struct tag if it matches, so it is recommended to set fields that should NOT be targeted by form/json decoding with the "-" value to explicitly disable them.
For cookie decoding other than the "raw" option, it assumes the value is base64URL encoded without any padding.