0
を呼び出すリクエストを送信するコードです -には、以下の
var requestData = {
"trigger_id":global.config.primusConfig.trigger_id,
//"mobile":global.config.primusConfig.trigger_id,
"email": global.config.primusConfig.email,
"params":{
"Amount":"200"
}
/*,
"files":{
“sample.pdf” : fileData
}*/
};
request({
headers: {
'cid': global.config.primusConfig.client_id,
'datetime': datetime,
'hash': hash,
'Content-type': 'application/json',
'From':'[email protected]'
},
url: global.config.primusConfig.apiEndPoint,
method: 'POST',
form: requestData,
body : req.rawBody,
},
function(error,httpResponse,body) {
console.log("Response handling part "+global.config.primusConfig.apiEndPoint+" formdata "+JSON.stringify(requestData));
if(error) {
console.log("Error "+error);
}
else {
console.log("Not error case- Body: "+body+" httpResponse:"+JSON.stringify(httpResponse));
callback();
}
});
ログインをhttpResponseから、私は実際に送信されたリクエスト見ることができます -
httpResponse:{"statusCode":500,"body":"\n <h1> 500 - Internal server error </h
1>\n <h2> </h2>\n","headers":{"content-type":"text/html; charset=utf-8","date"
:"Tue, 31 Oct 2017 15:19:13 GMT","etag":"W/\"38-3b8a0f21\"","x-powered-by":"Expr
ess","content-length":"56","connection":"Close"},"request":{"uri":{"protocol":"h
ttps:","slashes":true,"auth":null,"host":"domain.com","port":4
43,"hostname":"domain.com","hash":null,"search":null,"query":n
ull,"pathname":"/sendnotification","path":"/sendnotification","href":"domain.com/sendnotification"},"method":"POST","headers":{"cid":"
19","datetime":"2017-10-31 00:00:00","hash":"88072482e5125ed69f28ce60af859653049
9e11d","Content-type":"application/x-www-form-urlencoded","From":"[email protected]
ple.com","content-length":70}}}
を
From属性が[email protected]
に設定されていることがわかりましたが、修正しましたが、に変更されたContent-type
は表示されません。
誰かが説明できますか?すべてのポインタ?