【问题标题】:req.url not showing the full URLreq.url 没有显示完整的 URL
【发布时间】:2017-02-13 23:33:40
【问题描述】:

我正在使用 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 );

【问题讨论】:

  • 你是怎么做到的。隐藏代码?
  • @UnknownDeveloper,我刚刚更新了我的问题。
  • 您的 /hello/:name 网址在哪里? @user994165

标签: node.js express restify


【解决方案1】:

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

【讨论】:

  • 您能否解释一下您是如何发送网址的,我添加了双引号仍然无法访问完整的网址,包括查询参数
猜你喜欢
  • 1970-01-01
  • 2016-08-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-01-13
  • 2012-10-19
相关资源
最近更新 更多