File tree Expand file tree Collapse file tree 1 file changed +16
-15
lines changed Expand file tree Collapse file tree 1 file changed +16
-15
lines changed Original file line number Diff line number Diff line change @@ -145,21 +145,22 @@ class API {
145145 // Body parser
146146 // POST /v1/logs (1 MB max so 1.1 MB w/overhead)
147147 // POST /v1/emails (50 MB max so 51 MB w/overhead)
148- app . use ( ( ctx , next ) => {
149- // check against ignored paths
150- if (
151- Array . isArray ( this . config . bodyParserIgnoredPathGlobs ) &&
152- this . config . bodyParserIgnoredPathGlobs . length > 0
153- ) {
154- const match = multimatch (
155- ctx . path ,
156- this . config . bodyParserIgnoredPathGlobs
157- ) ;
158- if ( Array . isArray ( match ) && match . length > 0 ) return next ( ) ;
159- }
160-
161- return bodyParser ( ) ( ctx , next ) ;
162- } ) ;
148+ if ( this . config . bodyParser !== false )
149+ app . use ( ( ctx , next ) => {
150+ // check against ignored paths
151+ if (
152+ Array . isArray ( this . config . bodyParserIgnoredPathGlobs ) &&
153+ this . config . bodyParserIgnoredPathGlobs . length > 0
154+ ) {
155+ const match = multimatch (
156+ ctx . path ,
157+ this . config . bodyParserIgnoredPathGlobs
158+ ) ;
159+ if ( Array . isArray ( match ) && match . length > 0 ) return next ( ) ;
160+ }
161+
162+ return bodyParser ( this . config . bodyParser || { } ) ( ctx , next ) ;
163+ } ) ;
163164
164165 // Pretty-printed json responses
165166 app . use ( json ( ) ) ;
You can’t perform that action at this time.
0 commit comments