Permalink
Browse files

Strip out query string when checking for .json.

  • Loading branch information...
1 parent 07ceb61 commit 8bbce340af96ea38d9731ca39bc2610f7ec4ea16 @olalonde committed Nov 26, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 index.js
View
@@ -1,6 +1,8 @@
+var url = require('url');
+
module.exports = function() {
return function (req, res, next) {
- if (req.url.match(/\.json$/)) {
+ if (url.parse(req.url).pathname.match(/\.json$/)) {
// url ends with json
req.headers.accept = 'application/json';
};

0 comments on commit 8bbce34

Please sign in to comment.