Skip to content

Commit

Permalink
Fix #212
Browse files Browse the repository at this point in the history
  • Loading branch information
milani committed Oct 26, 2012
1 parent 8a8a660 commit cf55d98
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/router/Request.js
Expand Up @@ -5,11 +5,20 @@ var ClientRequest = require('http').ClientRequest,

module.exports = Request;

function objectKeysToLower(obj){
for(prop in obj) {
if(!obj.hasOwnProperty(prop) || typeof obj[prop] == "function") continue;
obj[prop.toLowerCase()] = obj[prop];
delete obj[prop];
}
return obj;
}

function Request(request){
var decodedURL = decodeURIComponent(request.url);
var parsed = url.parse(decodedURL, true);
this.url = decodedURL;
this.headers = request.headers;
this.headers = objectKeysToLower(request.headers);
this.method = request.method.toLowerCase();
this.pathname = parsed.pathname;
this.hash = parsed.hash;
Expand Down

0 comments on commit cf55d98

Please sign in to comment.