Created
December 4, 2013 04:47
-
-
Save chenzhihao/7782507 to your computer and use it in GitHub Desktop.
post type check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function JSONOnly(req, res, next) { | |
console.log(req.header('accept')); | |
console.log(req.is('json')); | |
if (!req.is('json')) { | |
res.send(406); | |
} | |
else { | |
next(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment