I need to get the RAW body from a listener node

Hi @stefanopog,

i had some time digging into it and now it might i've found a solution by picking up @shrickus hint with the httpNodeMiddleware.

In the first tests with the httpNodeMiddleware I discovered that the request already has ben parsed at this point. So I started tracking down where it got parsed and found it: It seems to be a default handler from the admin-UI at this point:


After discovering this line 36 gave me the right hint: We just get the admin UI away form the default path by setting something like httpAdminRoot: '/admin', in settings.js and voila - the request is unparsed in httpNodeMiddleware.

As next step I've created an own jsonParser setting me the raw body. I've also placed this code into settings.js just before the module.exports = { line:

var bodyParser = require('body-parser');
var jsonParserWithRawBody = bodyParser.json({
    verify: function (req, res, buf, encoding) {
        req.rawBody = buf;
    }
})

This parser stores the body into req.rawBody for later usage...

some lines down in settings.js i've commented in the httpNodeMiddleware and conditionally added my parser:

    httpNodeMiddleware: function(req,res,next) {
        if (req.url === '/my/httpin/url/where/i/want/to/have/the/raw/body') {
           jsonParserWithRawBody(req, res, next);
        } else
           next();
    },

Now i have the rawBody for my httpin to do all my authentication stuff...

Cheers, Chris