3
我無法說服Node.js的看到,第二個參數從我的網址:Node.js的忽略所有的查詢字符串參數除了第一個
http://localhost:8888/cities?tag=123&date=2013-03-30T10:00:28.000%2B02:00
我開始用下面的命令Node.js的服務器:
node --debug ./router_rest.js
我有下面的代碼在我的 「router_rest.js」 文件:
require("http").createServer(function (req, res) {
// For PUT/POST methods, wait until the
// complete request body has been read.
if (req.method==="POST" || req.method==="PUT") {
var body = "";
req.on("data", function(data){
body += data;
})
req.on("end", function(){
return routeCall(req, res, body);
})
} else {
return routeCall(req, res, "");
}
}).listen(8888);
我提出以下從命令行調用:
curl http://localhost:8888/cities?tag=123&date=2013-03-30T10:00:28.000%2B02:00
當調試和檢查「請求」參數(在匿名函數以上),url屬性顯示爲:
/cities?tag=123
我期待報告的網址成爲:
/cities?tag=123&date=2013-03-30T10:00:28.000%2B02:00
即使當我切換參數,節點仍然只看到第一個。
爲什麼最後一個參數(即日期)被截斷?
啊是的......在完全錯誤的地方尋找問題。謝謝。 – gavdotnet