Merge pull request #316 from dead-horse/parseurl

use parseurl
This commit is contained in:
TJ Holowaychuk 2014-07-14 08:19:25 -07:00
commit 2a040da429
2 changed files with 8 additions and 10 deletions

View file

@ -3,13 +3,12 @@
* Module dependencies.
*/
var stringify = require('url').format;
var typer = require('media-typer');
var parse = require('parseurl');
var qs = require('querystring');
var typeis = require('type-is');
var fresh = require('fresh');
var url = require('url');
var typer = require('media-typer');
var stringify = url.format;
var parse = url.parse;
/**
* Prototype.
@ -79,8 +78,7 @@ module.exports = {
*/
get path() {
var c = this._pathcache = this._pathcache || {};
return c[this.url] || (c[this.url] = parse(this.url).pathname);
return parse(this.req).pathname;
},
/**
@ -91,7 +89,7 @@ module.exports = {
*/
set path(path) {
var url = parse(this.url);
var url = parse(this.req);
url.pathname = path;
this.url = stringify(url);
},
@ -130,8 +128,7 @@ module.exports = {
*/
get querystring() {
var c = this._qscache = this._qscache || {};
return c[this.url] || (c[this.url] = parse(this.url).query || '');
return parse(this.req).query || '';
},
/**
@ -142,7 +139,7 @@ module.exports = {
*/
set querystring(str) {
var url = parse(this.url);
var url = parse(this.req);
url.search = str;
this.url = stringify(url);
},

View file

@ -38,6 +38,7 @@
"dethroy": "~1.0.0",
"error-inject": "~1.0.0",
"vary": "~0.1.0",
"parseurl": "~1.1.3",
"only": "0.0.2"
},
"devDependencies": {