如何监控node.js上的网络类似于chrome / firefox开发人员工具? [英] how to monitor the network on node.js similar to chrome/firefox developer tools?
问题描述
在开发客户端javascript应用程序时,开发人员网络面板对于调试网络问题非常有用:
When developing client side javascript applications, the developer network panel is invaluable for debugging network issues:
创建NodeJS应用程序的开发人员如何监控从nodejs应用程序到http的网络流量/ https服务器?例如,如何调试以下网络流量?
How does a developer creating a NodeJS application monitor the network traffic from the nodejs application to a http/https server? For example how to debug the following network traffic?
var http = require('http');
var req = http.request ...
req.write ...
req.send()
我的代码正在拨打第三方https服务器,因此我无法使用wireshark或类似的数据包嗅探工具。
My code is making a call to a third party https server, so I am unable to use wireshark or similar packet sniffing tools.
有关详细信息,我要调查的问题是这里。
For more information, the problem I am trying to investigate is here.
编辑:
以下是类似的问题,询问如何在其他语言:
Here are similar questions asking how to do the same thing in other languages:
- PYTHON: How can I see the entire HTTP request that's being sent by my Python application?
- JAVA: How to enable logging for apache commons HttpClient on Android
推荐答案
我知道它不漂亮,但你总是能在控制台内输出响应头的内容您的请求电话:
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.
这篇关于如何监控node.js上的网络类似于chrome / firefox开发人员工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!