Skip to content

Instantly share code, notes, and snippets.

@enreeco
Last active August 7, 2016 17:37
Show Gist options
  • Save enreeco/7155866 to your computer and use it in GitHub Desktop.
Save enreeco/7155866 to your computer and use it in GitHub Desktop.
NodeJS ExpressJS Getting Raw Body on request object
app.configure(function() {
//. . .
app.use(express.bodyParser());
app.use(function(req, res, next) {
var data = '';
req.setEncoding('utf8');
req.on('data', function(chunk) {
data += chunk;
});
req.on('end', function() {
req.rawBody = data;
});
next();
});
//. . .
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment