Skip to content

Instantly share code, notes, and snippets.

@chenzhihao
Created December 4, 2013 04:47
Show Gist options
  • Save chenzhihao/7782507 to your computer and use it in GitHub Desktop.
Save chenzhihao/7782507 to your computer and use it in GitHub Desktop.
post type check
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