@@ -139,6 +139,13 @@ describe(``, () => {
139139 multipleDateValues ?: Date [ ] ;
140140 }
141141
142+ class QueryWhitelistClass {
143+ @IsArray ( )
144+ @IsBoolean ( { each : true } )
145+ @Transform ( value => ( Array . isArray ( value ) ? value . map ( v => v !== 'false' ) : value !== 'false' ) )
146+ multipleBooleanValues ?: boolean [ ] ;
147+ }
148+
142149 @Controller ( )
143150 class UserActionParamsController {
144151 @Get ( '/users' )
@@ -239,6 +246,14 @@ describe(``, () => {
239246 return `<html><body>hello</body></html>` ;
240247 }
241248
249+ @Get ( '/photos-params-whitelist' )
250+ getPhotosWithWhitelistQuery (
251+ @QueryParams ( { validate : { whitelist : true , forbidNonWhitelisted : true } } ) query : QueryWhitelistClass
252+ ) : string {
253+ queryParams3 = query ;
254+ return `<html><body>hello</body></html>` ;
255+ }
256+
242257 @Get ( '/photos-with-required' )
243258 getPhotosWithIdRequired ( @QueryParam ( 'limit' , { required : true } ) limit : number ) : string {
244259 queryParamLimit = limit ;
@@ -594,6 +609,14 @@ describe(``, () => {
594609 expect ( queryParams1 . multipleDateValues ) . toEqual ( [ new Date ( '2017-02-01T01:00:00Z' ) ] ) ;
595610 } ) ;
596611
612+ it ( "@QueryParams should give a proper values from request's query with validate whitelist option on" , async ( ) => {
613+ expect . assertions ( 3 ) ;
614+ const response = await axios . get ( '/photos-params-whitelist?multipleBooleanValues=false' ) ;
615+ expect ( response . status ) . toEqual ( HttpStatusCodes . OK ) ;
616+ expect ( response . headers [ 'content-type' ] ) . toEqual ( 'text/html; charset=utf-8' ) ;
617+ expect ( queryParams3 . multipleBooleanValues ) . toEqual ( [ false ] ) ;
618+ } ) ;
619+
597620 it ( "@QueryParams should give a proper values from request's query parameters with nested json" , async ( ) => {
598621 expect . assertions ( 13 ) ;
599622 const response = await axios . get (
0 commit comments