Browse Source

Rename req.uri.queryKey to req.uri.params. More familar to rails users.

v0.7.4-release
Ryan 16 years ago
parent
commit
8bf2a2fa55
  1. 12
      src/http.js
  2. 2
      website/api.html

12
src/http.js

@ -45,6 +45,10 @@ node.http.STATUS_CODES = { 100 : 'Continue'
MIT License MIT License
*/ */
function decode (s) {
return decodeURIComponent(s.replace(/\+/g, ' '));
}
node.http.parseUri = function (str) { node.http.parseUri = function (str) {
var o = node.http.parseUri.options, var o = node.http.parseUri.options,
m = o.parser[o.strictMode ? "strict" : "loose"].exec(str), m = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
@ -55,7 +59,11 @@ node.http.parseUri = function (str) {
uri[o.q.name] = {}; uri[o.q.name] = {};
uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) { 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; }; uri.toString = function () { return str; };
@ -80,7 +88,7 @@ node.http.parseUri.options = {
, "anchor" , "anchor"
], ],
q: { q: {
name: "queryKey", name: "params",
parser: /(?:^|&)([^&=]*)=?([^&]*)/g parser: /(?:^|&)([^&=]*)=?([^&]*)/g
}, },
parser: { parser: {

2
website/api.html

@ -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.user</code>
<dt><code>req.uri.authority</code> <dt><code>req.uri.authority</code>
<dt><code>req.uri.protocol</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> <dt><code>req.uri.toString()</code>, <code>req.uri.source</code>
<dd> The original URI found in the status line. <dd> The original URI found in the status line.

Loading…
Cancel
Save