如何使用Fiddler从请求节点库中捕获HTTP消息 [英] How to capture http messages from Request Node library with Fiddler

查看:53
本文介绍了如何使用Fiddler从请求节点库中捕获HTTP消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Fiddler中可以很好地捕获对节点服务器的常规客户端发起的请求.但是,未捕获从节点发送到Web服务的请求.将代理的配置(127.0.0.1:8888)传递给请求方法无济于事.如何通过Fiddler路由请求消息?

Regular client initiated requests to the node server are captured fine in Fiddler. However, requests sent from node to a web service are not captured. It did not help to pass in config for proxy (127.0.0.1:8888) to the request method. How can I route the request messages through Fiddler?

var http = require('http');
var request = require('request');

request.get(webserviceURL, { "auth" : {"user": "user", "pass" = "pass", sendImmediately: true },
"proxy" : { "host" : "127.0.0.1", "port" : 8888 }},
function (error, response) { console.log( "response received" );
});

请求回购: https://github.com/mikeal/request

推荐答案

我只是尝试自己做(使用Fiddler和npm的请求库).这是我的工作方式:

I just tried to do this myself (using Fiddler and the request library from npm). Here's how I got it working:

process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0'; // Ignore 'UNABLE_TO_VERIFY_LEAF_SIGNATURE' authorization error

// Issue the request
request(
{
    method: "GET",
    uri: "https://secure.somewebsite.com/",
    proxy: "http://127.0.0.1:8888" // Note the fully-qualified path to Fiddler proxy. No "https" is required, even for https connections to outside.
},
function(err, response, body) {
    console.log("done");
});

这是Fiddler2使用的默认端口和代理选项(并且没有代理身份验证).

This is with Fiddler2 using the default port and proxy options (and no proxy authentication).

这篇关于如何使用Fiddler从请求节点库中捕获HTTP消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆