我制作了一个节点服务器,我必须记录它所做的一切。我使用 Requestify 来做 POST 请求。
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));
});
如何获取整个 JSON 请求?(不是响应,而是请求)