Friday 21 April 2017

Node - Log my request after a POST with requestify

I make a node server and i must logging everything it does. I use Requestify to do POST request.

    requestify.request(uriGoogleApi, {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': 'key=' + serverKey
    },
    body: {
        "notification": {
            "title": prefix + news.title,
            "body": news.highlight,
            "sound": "default",
            "click_action": "FCM_PLUGIN_ACTIVITY",
            "icon": "",
            "content_available": true
        },
        "data": {
            "url": news.newsUrl,
            "id": news.id,
            "type": "news"
        },
        "condition": jobs,
        "priority": priority
    }
}).then(function (response) {
    console.log("==> pushNews : " + news.id);
    console.debug("Content news pushed: " + JSON.stringify(news));

}).fail(function (err) {
    console.log(err);
    console.debug(JSON.stringify(news));
});

How to get the entire JSON request? (Not the response but the request)



via Dathov

No comments:

Post a Comment