how to monitor the network on node.js similar to chrome/firefox developer tools?

后端 未结 5 1801
猫巷女王i
猫巷女王i 2021-01-31 02:05

When developing client side javascript applications, the developer network panel is invaluable for debugging network issues:

5条回答
  •  南方客
    南方客 (楼主)
    2021-01-31 02:48

    I know it's not pretty, but you could always output the content of the response headers on the console inside your request call:

    var req = https.request(options, function(res) {
        console.log("statusCode: ", res.statusCode);
        console.log("headers: ", res.headers);
    
        res.on('data', function(d) {
            process.stdout.write(d);
        });
    });
    

    Your original question, however, was not about problems with the server side but rather a problem with the node code itself so this wouldn't be of much use here.

提交回复
热议问题