Skip to content
masterclass Buddy

Express.js · Method

res.format

res.format() selects a response handler by comparing the request's Accept header with the formats you provide. It sends 406 for no match unless you define a default handler.

Last updated

Syntax

res.format(object)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • req.accepts()
  • res.send()
  • res.json()
  • res.set()
  • res.type()

Source: Response · Express.js. Checked 2026-11-03.