File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change 1
1
import type { BaseConfitSchema } from '@sesamecare-oss/confit' ;
2
2
import type { middleware } from 'express-openapi-validator' ;
3
3
import type { Level } from 'pino' ;
4
+ import bodyParser from 'body-parser' ;
4
5
5
6
export interface ConfigurationItemEnabled {
6
7
enabled ?: boolean ;
@@ -28,8 +29,8 @@ export interface ConfigurationSchema extends BaseConfitSchema {
28
29
etag ?: boolean ;
29
30
cookieParser ?: boolean ;
30
31
bodyParsers ?: {
31
- json ?: boolean ;
32
- form ?: boolean ;
32
+ json ?: boolean | Parameters < typeof bodyParser . json > [ 0 ] ;
33
+ form ?: boolean | Parameters < typeof bodyParser . urlencoded > [ 0 ] ;
33
34
} ;
34
35
// Set static.enabled to true to enable static assets to be served
35
36
static ?: ConfigurationItemEnabled & {
Original file line number Diff line number Diff line change @@ -174,6 +174,7 @@ export async function startApp<
174
174
}
175
175
176
176
if ( routing ?. bodyParsers ?. json ) {
177
+ const jsonArgs = typeof routing . bodyParsers . json === 'object' ? routing . bodyParsers . json : { } ;
177
178
app . use (
178
179
express . json ( {
179
180
verify ( req , res , buf ) {
@@ -182,6 +183,7 @@ export async function startApp<
182
183
locals . rawBody = buf ;
183
184
}
184
185
} ,
186
+ ...jsonArgs ,
185
187
} ) ,
186
188
) ;
187
189
}
You can’t perform that action at this time.
0 commit comments