2015-10-01 00:30:16 +02:00

45 lines
794 B
JavaScript

'use strict';
/**
* Body parser hook
*/
module.exports = function (strapi) {
const hook = {
/**
* Default options
*/
defaults: {
parser: {
encode: 'utf-8',
formLimit: '56kb',
jsonLimit: '1mb',
strict: true,
extendTypes: {
json: ['application/x-javascript']
}
}
},
/**
* Initialize the hook
*/
initialize: function (cb) {
strapi.app.use(strapi.middlewares.bodyparser({
encode: strapi.config.parser.encode,
formLimit: strapi.config.parser.formLimit,
jsonLimit: strapi.config.parser.jsonLimit,
strict: strapi.config.parser.strict,
extendTypes: strapi.config.parser.extendTypes
}));
cb();
}
};
return hook;
};