connect-trim-body
v0.0.3
Published
Connect/Express middleware to trim all parameters in request body. Works recursively.
Downloads
207
Maintainers
Readme
connect-trim-body
Connect/Express middleware to trim parameters in request body. Works recursively.
Dependencies
Requires body-parser middleware.
Usage
var express = require('express')
, bodyParser = require('body-parser')
, trimBody = require('connect-trim-body')
;
var app = express();
app.use(bodyParser()); // body-parser first
app.use(trimBody());
app.post('/products', function (req, res) {
res.json(req.body);
});
app.listen(3000);
{
"brand": "HP",
"model": "EliteBook",
"description": " some stuff "
}
// becomes
{
"brand": "HP",
"model": "EliteBook",
"description": "some stuff"
}
License
MIT