is there a way to access the payload from an POST ajax request?
can't find any trace of it inside req
middleware: function (req, res, next) {
if (req.url.match(/^.*\/api\/.*/)) {
// WHERE IS THE POST DATA ?!?
req.???
}
next();
}
Browsersync does not modify the request, so it's likely you're trying to access data where it's not available.
If you still think this is a bug, please provide a working example which I can look at and debug :)
@shakyShane I'm pretty sure it didn't work on normal POST and PUT requests, thats why I've created this PR https://github.com/BrowserSync/browser-sync/pull/896
Maybe I get something wrong, but the question is about something like this (stolen from http://blog.frankgrimm.net/2010/11/howto-access-http-message-body-post-data-in-node-js/):
req.on('data', function(chunk) {
console.log("Received body data:");
console.log(chunk.toString());
});
Most helpful comment
Maybe I get something wrong, but the question is about something like this (stolen from http://blog.frankgrimm.net/2010/11/howto-access-http-message-body-post-data-in-node-js/):