2

我在尝试运行运行 npm request-promise 以调用 REST 服务的 Mocha JS 测试用例时遇到以下错误。我能够通过 ARC 客户端连接到 REST URI 端点,但在通过组织的代理运行时失败并出现以下错误-

     RequestError: Error: connect ETIMEDOUT SERVER_IP:SERVER_PORT
  at new RequestError (<Some_Path>\errors.js:14:15)
  at Request.plumbing.callback (<Some_Path>\plumbing.js:87:29)
  at Request.RP$callback [as _callback] (<Some_Path>\plumbing.js:46:31)
  at self.callback (<Some_Path>\request.js:188:22)
  at Request.onRequestError (<Some_Path>\request\request.js:884:8)
  at TLSSocket.socketErrorListener (_http_client.js:309:9)
  at emitErrorNT (net.js:1277:8)
  at _combinedTickCallback (internal/process/next_tick.js:80:11)
  at process._tickCallback (internal/process/next_tick.js:104:9)
4

2 回答 2

4

request-promise我通过在选项中添加以下内容来解决此问题-

proxy:'http://PROXY_SERVER_IP:PORT#'

我希望这有帮助。

干杯,库纳尔

于 2017-07-04T08:57:37.187 回答
0

这对我有用

var request = require('request-promise').defaults({ proxy:' http://username:password@host:port ', strictSSL :false });

于 2018-12-26T03:56:29.650 回答