编辑。
再一次,我不知道如何解决这个问题(简单,我确定)。也许你可以告诉我一条道路..:我无法得到休息GET请求的“正文”。
更确切地说:
知道发生了什么事吗?
非常感谢..
var bodyParser = Meteor.npmRequire( 'body-parser' );
Picker.middleware( bodyParser.json() );
Picker.middleware( bodyParser.urlencoded( { extended: false } ) );
Picker.route( '/documents', function( params, request, response, next ) {
if (client.findOne({_id:"EJB3KDgTwBzvoe3y6"})){
console.log("blabla");
// with just 'params' I get something verbose in my terminal, including my message, but I don't know how to 'catch' it
console.log( request.body );
// messages.insert({
// message: request....
// });
response.setHeader( 'Content-Type', 'application/xml' );
response.statusCode = 200;
response.end( "<Response><Message>Bonjour, I'm becky</Message></Response>" );
}
else {
response.setHeader( 'Content-Type', 'application/xml' );
response.statusCode = 200;
response.end( "<Response><Message>Hello, don't knou you..</Message></Response>" );
}
});
编辑2: 这就是我在终端(流星)中得到的内容
I20160228-16:53:22.209(1)? { query:
I20160228-16:53:22.210(1)? { ToCountry: 'FR',
I20160228-16:53:22.210(1)? ToState: '',
I20160228-16:53:22.210(1)? SmsMessageSid: 'SMf8eae81eb0f2bd',
I20160228-16:53:22.210(1)? NumMedia: '0',
I20160228-16:53:22.210(1)? ToCity: '',
I20160228-16:53:22.210(1)? FromZip: '',
I20160228-16:53:22.210(1)? SmsSid: 'SMf8eae81eb0f2bd',
I20160228-16:53:22.210(1)? FromState: '',
I20160228-16:53:22.211(1)? SmsStatus: 'received',
I20160228-16:53:22.211(1)? FromCity: '',
I20160228-16:53:22.211(1)? Body: 'my message I want to catch and store in my db',
I20160228-16:53:22.211(1)? FromCountry: 'FR',
I20160228-16:53:22.211(1)? To: '+xxxxxxxxxxxxxx',
I20160228-16:53:22.211(1)? ToZip: '',
I20160228-16:53:22.211(1)? NumSegments: '1',
I20160228-16:53:22.211(1)? MessageSid: 'SMf8eae81eb',
I20160228-16:53:22.211(1)? AccountSid: 'AC72924a656',
I20160228-16:53:22.211(1)? From: '+xxxxxxxxxxxxx',
I20160228-16:53:22.212(1)? ApiVersion: '2010-04-01' } }