Skip to content

Instantly share code, notes, and snippets.

@shesek
Last active December 11, 2015 19:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shesek/4651267 to your computer and use it in GitHub Desktop.
Save shesek/4651267 to your computer and use it in GitHub Desktop.
module.exports = (req, res, next) ->
return do next unless req.is 'text/plain'
req.body = ''
req.on 'data', (data) -> req.body += data
req.on 'end', next
module.exports = function(req, res, next) {
if (!req.is('text/plain')) {
return next();
}
req.body = '';
req.on('data', function(data) {
return req.body += data;
});
return req.on('end', next);
};
{
"name": "connect-plain-body",
"version": "0.0.2",
"main": "connect-plain-body.js",
"repository": {
"type": "git",
"url": "git://gist.github.com/4651267.git"
},
"license": "BSD"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment