Documentation
¶
Overview ¶
Package contenttype rejects request bodies of media types or content codings the application does not accept.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(configs ...Config) zinc.Middleware
New answers 415 Unsupported Media Type for a request whose Content-Type or Content-Encoding is not listed in config.
Types ¶
type Config ¶
type Config struct {
// Types are the accepted media types, such as "application/json".
// Parameters are ignored, so "application/json; charset=utf-8" matches.
Types []string
// Encodings are the accepted content codings, such as "gzip". A request
// without Content-Encoding is "identity", so list it to allow plain bodies.
Encodings []string
}
Config lists what requests may send. An empty list allows anything.
Click to show internal directories.
Click to hide internal directories.