package accept
import "github.com/streadway/handy/accept"
Package accept contains filters to reject requests without a specified Accept header with "406 Not Acceptable".
Index ¶
Constants ¶
const ( // ALL matches all media types. ALL = "*/*" )
Variables ¶
var ( // EventStream matches media typs used for SSE events. EventStream = Middleware("text/event-stream", "text/*") // HTML matches media typs used for HTML encoded resources. HTML = Middleware("text/html") // JSON matches media typs used for JSON encoded resources. JSON = Middleware("application/json", "application/javascript") // Plain matches media typs used for plaintext resources. Plain = Middleware("text/plain") // XML matches media typs used for XML encoded resources. XML = Middleware("application/xhtml+xml", "application/xml") )
Functions ¶
func Middleware ¶
Middleware returns a composable handler factory to restrict accepted media types and respond with "406 Not Acceptable" otherwise.
Source Files ¶
- Version
- v0.0.0-20200128134331-0f66f006fb2e (latest)
- Published
- Jan 28, 2020
- Platform
- linux/amd64
- Imports
- 3 packages
- Last checked
- 2 months ago –
Tools for package owners.