Tag: charles

Nodejs请求“代理”选项不是通过定义的主机的路由请求

我很难查看Node js应用程序和API之间交换的信息。 开发人员正在使用请求模块。 查看自述文件,有一个选项叫做'proxy': proxy – An HTTP proxy to be used. Supports proxy Auth with Basic Auth, identical to support for the url parameter (by embedding the auth info in the uri) 但是,当我添加代理作为一个选项似乎被丢弃,因为当请求传递到服务器时,我看不到在我的HTTP代理(查尔斯或提琴手) 我正在使用的选项是: exports.defaultOptions = function(){ return { host: config.apiHost, // API url to connect too headers: { 'Content-Type': 'application/json' }, method: 'POST', […]

错误:主机名/ IP不符合证书的名称:

我使用axios作为node.js的HTTP客户端 我在本地端口和端口8888上使用代理,所以我可以用Charles Proxy来嗅探networkingstream量以进行debugging。 axios.get(`http://example.com', { proxy: { host: '127.0.0.1', port: 8888 }) .then(result => { // }) .catch(error => { console.log(error) }) 有了这个configuration,我经常收到这个错误信息: 错误:主机名/ IP不符合证书的名称: 我在这里读到: Node.js主机名/ IP不匹配证书的altnames ,我必须像这样configurationnode.js来禁用安全检查: { rejectUnauthorized : false } 我的问题是如何以及在哪里做我的configuration?

当我使用node-horseman打开nodejs的phantomjs时,幻像进程死亡

当我用Node.js来控制phantomjs时,遇到了一个问题: Unhandled rejection HeadlessError: Phantom Process died at ClientRequest. (/Users/zhuyingda/nodejs/veneno/node_modules/node-phantom-simple/node-phantom-simple.js:655:12) at emitOne (events.js:77:13) at ClientRequest.emit (events.js:169:7) at Socket.socketOnEnd (_http_client.js:288:9) at emitNone (events.js:72:20) at Socket.emit (events.js:166:7) at endReadableNT (_stream_readable.js:905:12) at doNTCallback2 (node.js:441:9) at process._tickCallback (node.js:355:17) 我只是运行这个代码: var Horseman = require('node-horseman'); var horseman = new Horseman(); horseman .userAgent("Mozilla/5.2 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0") .on('resourceRequested', function […]