How to capture http messages from Request Node library with Fiddler

前端 未结 5 1212
清酒与你
清酒与你 2021-02-12 12:33

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

5条回答
  •  粉色の甜心
    2021-02-12 12:56

    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");
    });
    

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

提交回复
热议问题