Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 如何在nodejs中调试request.post_Node.js_Debugging_Post_Request - Fatal编程技术网

Node.js 如何在nodejs中调试request.post

Node.js 如何在nodejs中调试request.post,node.js,debugging,post,request,Node.js,Debugging,Post,Request,能给我一些想法来调试下面的代码片段吗 var request = require('request'); function sendINFO() { var jsonString = { reportType: 'customer', comment: customerDetails.cust_id, imageUrl: customerDetails.url1 } console.log('json string', j

能给我一些想法来调试下面的代码片段吗

var request = require('request');

function sendINFO() {
    var jsonString = {
        reportType: 'customer',
        comment: customerDetails.cust_id,
        imageUrl: customerDetails.url1
    }
    console.log('json string', jsonString)
    request.post(
        'http://52.7.0.131/SendInfo/XC1K1AZ9', {
            json: jsonString
        },
        function(error, response, body) {
            console.log('response after adding report', response, 'error', error)
            if (!error && response.statusCode == 200) {
                console.log(body)
            }
        }
    );
}
我想检查一下它是否工作正常。以及如何用postman api测试这一点


非常感谢您在URL部分的“邮递员”中提供的帮助添加52.7.0.131/SendInfo/XC1K1AZ9此URL的方法为POST,然后导航到body tag,然后选择raw单选按钮。然后在同一行中,您将看到[Text]组合框,单击该组合框并选择JSON(应用程序/JSON)。然后只粘贴
{reportType:'customer',comment:customerDetails.cust_id,imageUrl:customerDetails.url1}
下面这部分json,然后单击发送按钮。

在postman中,使用POST方法点击此url,并发送jsonString原始正文和格式的数据,因为JSONi无法理解您的意思。我只是喜欢这个52.7.0.131/AddReport/FC5E1BF6’,{json:jsonString}然后我选择了raw,在那里我给出了如下var jsonString={reportType:'customer',comment:customerDetails.cust_id,imageUrl:customerDetails.url1}仔细检查我的答案,下面的汉克斯先生,现在明白了。如果不使用postmancan,我将如何进行测试?您可以告诉我如何调试整个函数。我只是单独检查api。工作正常。但是,由于它处于该功能之下,因此它不起作用。。如何调试这个“函数sendINFO(){}在这种情况下,去webstorm编辑器。它为调试提供了很好的功能。它是付费的。有30天的试用版。你可以试试。除了这个节点,还有insepctor。但是webstorm是最好的