0

I'd like to dump out, via sails.log.debug(), the raw POSTed data as seen by a controller function. I am dealing with JSON coming from a third-party that may be badly formatted and need to figure out where/how. I'd like to see the whole, raw dump.

create: function(req, res) {
  sails.log.debug(???);
  //var ticket = JSON.parse(req.param("webhook"));

  return res.echoRequest(true);
}
alphadogg
  • 12,762
  • 9
  • 54
  • 88

2 Answers2

0

You could use:

var packet = req.params.all();
sails.log.debug(packet);

Hope that helps.

myusuf
  • 11,810
  • 11
  • 35
  • 50
0

You will need to use middleware to get the "RAW" body. You will want to grab that pre-sails Check out answer to this question Node.js - get raw request body using Express

Community
  • 1
  • 1
Meeker
  • 5,979
  • 2
  • 20
  • 38