Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var StringDecoder = require("string_decoder").StringDecoder
- module.exports = body
- function body(req, callback) {
- var requestBody = "",
- stringDecoder = new StringDecoder
- req.on("data", addToBody)
- req.on("end", returnBody)
- function addTobody(buffer) {
- requestBody += stringDecoder.write(buffer)
- }
- function returnBody() {
- callback(null, requestBody)
- }
- }
Add Comment
Please, Sign In to add comment