Something went wrong. Try again.
Something went wrong. Try again.
1.7 kB · 78 lines
TypeScript
at main
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879import { defineConfig } from '@adonisjs/core/bodyparser'
const bodyParserConfig = defineConfig({ /** * Parse request bodies for these HTTP methods. * Keep this aligned with methods that receive payloads in your routes. */ allowedMethods: ['POST', 'PUT', 'PATCH', 'DELETE'],
/** * Config for the "application/x-www-form-urlencoded" * content-type parser. */ form: { /** * Normalize empty string values to null. */ convertEmptyStringsToNull: true,
/** * Content types handled by the form parser. */ types: ['application/x-www-form-urlencoded'], },
/** * Config for the JSON parser. */ json: { /** * Normalize empty string values to null. */ convertEmptyStringsToNull: true,
/** * Content types handled by the JSON parser. */ types: [ 'application/json', 'application/json-patch+json', 'application/vnd.api+json', 'application/csp-report', ], },
/** * Config for the "multipart/form-data" content-type parser. * File uploads are handled by the multipart parser. */ multipart: { /** * Automatically process uploaded files into the system tmp directory. */ autoProcess: true,
/** * Normalize empty string values to null. */ convertEmptyStringsToNull: true,
/** * Routes where multipart processing is handled manually. */ processManually: [],
/** * Maximum accepted payload size for multipart requests. */ limit: '20mb',
/** * Content types handled by the multipart parser. */ types: ['multipart/form-data'], },})
export default bodyParserConfig