Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
Decode decodes form URL encoded requests and JSON requests from r into v. Also decodes path (chi only) and query parameters.
The requests Content-Type header informs if the request should be decoded using a form URL encoded decoder or using a JSON decoder.
A Content-Type of application/x-www-form-urlencoded will result in form decoding. Any other content type will result in JSON decoding because it is common to make JSON requests without a Content-Type where-as correctly formatted form URL encoded requests are more often accompanied by the appropriate Content-Type.
An error is returned if the Content-Type cannot be parsed by a mime media-type parser.
See DecodePath, DecodeQuery, DecodeForm and DecodeJSON for details about the types of errors that may occur.
func DecodeForm ¶
DecodeForm decodes form URL encoded requests from r into v.
The type of the value given can use `form` tags on fields in the same way as the `json` tag to name fields.
An error will be returned if the request is not a POST, PUT, or PATCH request.
An error will be returned if the request has a media type in the Content-Type not equal to application/x-www-form-urlencoded, or if the Content-Type header cannot be parsed.
func DecodeJSON ¶
DecodeJSON decodes JSON request from r into v.
func DecodePath ¶
DecodePath decodes parameters from the path in a request used with the github.com/go-chi/chi muxing module.
func DecodeQuery ¶
DecodeQuery decodes the query string from r into v.
Types ¶
This section is empty.