Skip to content
This repository has been archived by the owner on Aug 6, 2021. It is now read-only.

Latest commit

 

History

History
25 lines (17 loc) · 624 Bytes

req.accepts.md

File metadata and controls

25 lines (17 loc) · 624 Bytes

req.accepts()

Checks whether this request's stated list of "accepted" media types includes the specified type. Returns true or false.

Usage

req.accepts(type);

Example

req.accepts('application/json');
// -> true
req.accepts('json');
// -> true

Notes

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