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());
app.use(trimBody());
app.post('/products', function (req, res) {
res.json(req.body);
});
app.listen(3000);
{
"brand": "HP",
"model": "EliteBook",
"description": " some stuff "
}
{
"brand": "HP",
"model": "EliteBook",
"description": "some stuff"
}
License
MIT