mirror of https://github.com/nodejs/node.git
Rename req.uri.queryKey to req.uri.params. More familar to rails users.
parent
ed283dc280
commit
8bf2a2fa55
12
src/http.js
12
src/http.js
|
@ -45,6 +45,10 @@ node.http.STATUS_CODES = { 100 : 'Continue'
|
|||
MIT License
|
||||
*/
|
||||
|
||||
function decode (s) {
|
||||
return decodeURIComponent(s.replace(/\+/g, ' '));
|
||||
}
|
||||
|
||||
node.http.parseUri = function (str) {
|
||||
var o = node.http.parseUri.options,
|
||||
m = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
|
||||
|
@ -55,7 +59,11 @@ node.http.parseUri = function (str) {
|
|||
|
||||
uri[o.q.name] = {};
|
||||
uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {
|
||||
if ($1) uri[o.q.name][$1] = $2;
|
||||
if ($1) {
|
||||
var key = decode($1);
|
||||
var val = decode($2);
|
||||
uri[o.q.name][key] = val;
|
||||
}
|
||||
});
|
||||
uri.toString = function () { return str; };
|
||||
|
||||
|
@ -80,7 +88,7 @@ node.http.parseUri.options = {
|
|||
, "anchor"
|
||||
],
|
||||
q: {
|
||||
name: "queryKey",
|
||||
name: "params",
|
||||
parser: /(?:^|&)([^&=]*)=?([^&]*)/g
|
||||
},
|
||||
parser: {
|
||||
|
|
|
@ -486,7 +486,7 @@ It is passed to the user as the first argument to the <code
|
|||
<dt><code>req.uri.user</code>
|
||||
<dt><code>req.uri.authority</code>
|
||||
<dt><code>req.uri.protocol</code>
|
||||
<dt><code>req.uri.queryKey</code>
|
||||
<dt><code>req.uri.params</code>
|
||||
<dt><code>req.uri.toString()</code>, <code>req.uri.source</code>
|
||||
<dd> The original URI found in the status line.
|
||||
|
||||
|
|
Loading…
Reference in New Issue