Repository URL to install this package:
|
Version:
3.1.0 ▾
|
import jsonbody from 'body/json';
const jsonheader = /json/i;
export default ( req, res, next ) => {
if ( req.headers['content-type'] && jsonheader.test( req.headers['content-type'] ) ) {
jsonbody( req, res, ( err, body ) => {
if ( err !== null ) {
next( err );
return;
}
req.body = body;
next();
} );
}
};