req.url没有显示完整的URL

时间:2016-10-05 13:30:51

标签: node.js express restify

我使用Restify并且出于某种原因,req.url仅显示第一个查询参数的URL。 req.query也只显示queryStartDate。

http://localhost:6001/myapp/v1/filter/path1/path2/v4.0/mhs/query/path3/path4/path5?queryStartDate=19000101&queryEndDate=21000101&requestSource=source&includeSources=1&excludeSources=2

代码:

//Breakpoint in my first handler:
HttpHandlers.prototype.readHttpRequest = function (req, res, next) {
        req.locals = {};
        res.locals = {}; 
...

var httpHandlers = new HttpHandlers();
server.get('/hello/:name', httpHandlers.readHttpRequest );

1 个答案:

答案 0 :(得分:1)

原来这是由于我使用curl发送网址而不是用双引号括起网址引起的。 Linux看到“&”并在后台运行前面的命令,因此Node.js只能看到第一个“&”之前的所有内容。

相关问题