Skip to content

accepts

accepts: (options?) => Function

Defined in: http/accepts.js:48

Creates a content negotiation middleware.

Negotiation configuration

string[]

Acceptable character sets

string[]

Acceptable content encodings

string[]

Acceptable languages

boolean = false

Return {response: {statusCode: 406, detail}} if any negotiation key is undefined

string[]

Acceptable media types

Function

  • Middleware (req) => {type, language, charset, encoding} on success, or {response: {statusCode: 406, detail: string}} when throwIfFail is true and any negotiation value is undefined