Permalink
Browse files

add _accept param

  • Loading branch information...
1 parent 02a9da6 commit 9e94f51a923bc107d0832090bcccdf5086bc210b @AndersDJohnson AndersDJohnson committed with AndersDJohnson Jan 6, 2014
Showing with 5 additions and 1 deletion.
  1. +5 −1 index.js
View
@@ -2,7 +2,11 @@ var url = require('url');
module.exports = function() {
return function (req, res, next) {
- if (url.parse(req.url).pathname.match(/\.json$/)) {
+ var _acceptParam = req.param('_accept');
+ if (_acceptParam) {
+ req.headers.accept = _acceptParam;
+ }
+ else if (url.parse(req.url).pathname.match(/\.json$/)) {
req.headers.accept = 'application/json';
}
else if (url.parse(req.url).pathname.match(/\.xml$/)) {

0 comments on commit 9e94f51

Please sign in to comment.