File tree Expand file tree Collapse file tree 4 files changed +8
-2
lines changed
Expand file tree Collapse file tree 4 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ export const start = async () => {
133133 } ) ;
134134
135135 apiApp . use ( express . urlencoded ( { extended : true } ) ) ;
136- apiApp . use ( express . json ( ) ) ;
136+ apiApp . use ( express . json ( { limit : config . jsonParserLimit ?? utils . constants . DEFAULT_JSON_PARSER_LIMIT } ) ) ;
137137 apiApp . use ( '/api/v1' , apiRouter ) ;
138138 apiApp . use ( errorHandler ) ;
139139
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ export interface IConfig {
2929 id : string
3030 endpoint : string
3131 } [ ]
32+ jsonParserLimit ?: string
3233}
3334
3435export interface IFile {
Original file line number Diff line number Diff line change @@ -44,7 +44,8 @@ export const constants = {
4444 MAX_EVENT_QUEUE_SIZE : 1000 ,
4545 HASH_HEADER_NAME : 'dx-hash' ,
4646 SIZE_HEADER_NAME : 'dx-size' ,
47- LAST_UPDATE_HEADER_NAME : 'dx-last-update'
47+ LAST_UPDATE_HEADER_NAME : 'dx-last-update' ,
48+ DEFAULT_JSON_PARSER_LIMIT : '1mb'
4849} ;
4950const log = new Logger ( 'utils.ts' ) ;
5051axios . defaults . timeout = constants . REST_API_CALL_REQUEST_TIMEOUT ;
Original file line number Diff line number Diff line change 6060 }
6161 }
6262 }
63+ },
64+ "jsonParserLimit" : {
65+ "type" : " string" ,
66+ "pattern" : " ^\\ d+(k|K|m|M|g|G|t|T|p|P)?(b|B)$"
6367 }
6468 }
6569}
You can’t perform that action at this time.
0 commit comments