req.accepted

Contains an array of the “media types” this request (req) can accept (e.g. text/html or application/json), ordered from highest to lowest quality.

Usage

  1. req.accepted;

Example

  1. req.accepted;
  2. /*
  3. [ { value: 'application/json',
  4. quality: 1,
  5. type: 'application',
  6. subtype: 'json' },
  7. { value: 'text/html',
  8. quality: 0.5,
  9. type: 'text',
  10. subtype: 'html' } ]
  11. */

Notes

  • See the accepts module for the finer details of the header parsing algorithm used in Sails/Express/Koa/Connect.