Permalink
Browse files

Merge pull request #3 from adjohnson916/master

add _accept param
  • Loading branch information...
olalonde committed Feb 27, 2014
2 parents 02a9da6 + 9e94f51 commit 03649391d53114b5bfbba5125e9ba86ac167e032
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 0364939

Please sign in to comment.