accepts
accepts: (
options?) =>Function
Defined in: http/accepts.js:48
Creates a content negotiation middleware.
Parameters
Section titled “Parameters”options?
Section titled “options?”Negotiation configuration
charsets?
Section titled “charsets?”string[]
Acceptable character sets
encodings?
Section titled “encodings?”string[]
Acceptable content encodings
languages?
Section titled “languages?”string[]
Acceptable languages
throwIfFail?
Section titled “throwIfFail?”boolean = false
Return {response: {statusCode: 406, detail}} if any negotiation key is undefined
types?
Section titled “types?”string[]
Acceptable media types
Returns
Section titled “Returns”Function
- Middleware
(req) => {type, language, charset, encoding}on success, or{response: {statusCode: 406, detail: string}}whenthrowIfFailis true and any negotiation value is undefined