Wednesday, 12 April 2017

how to debug request.post in nodejs

could some give me idea to debug the below snippet.

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

i want to check whether it's working or not. and how to test this with postman api

many thanks for any help



via kimi

No comments:

Post a Comment