View our GitHub

Please visit sails-docs on GitHub to view documentation on your mobile device.

Edit Page

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

req.accepted;

Example

req.accepted;

/*
  [ { value: 'application/json',
      quality: 1,
      type: 'application',
      subtype: 'json' },
  { value: 'text/html',
       quality: 0.5,
       type: 'text',
       subtype: 'html' } ]
*/

Notes

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

Is something missing?

If you notice something we've missed or could be improved on, please follow this link and submit a pull request to the sails-docs repo. Once we merge it, the changes will be reflected on the website the next time it is deployed.

Reference

We wrote a book!

Get early access to the book
with promotion code: mcneildoc

Get the Book