Package httpparms provides helper functions and types to load the content of an HTTP request into a Go struct. It supports loading the query string parameters, the form-encoded body and the JSON-encoded body. If the struct implements the "Validator" interface, it also validates the values.
It supports various form decoders and JSON unmarshalers. Common such packages that can be used for forms are:
- github.com/go-playground/form (requires the FormDecoderAdapter) - github.com/gorilla/schema
Common packages that can be used for JSON are:
- encoding/json in the standard library - pquerna/ffjson/ffjson
The package also provides support to extract parameter names that failed validation so that a useful error message can be given to the caller.