Last active
August 7, 2016 17:37
-
-
Save enreeco/7155866 to your computer and use it in GitHub Desktop.
NodeJS ExpressJS Getting Raw Body on request object
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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