@@ -142,6 +142,16 @@ describe('API Routes', () => {
142142 expect ( Array . isArray ( res . body ) ) . toBe ( true ) ;
143143 } ) ;
144144
145+ it ( 'should return 400 when category filter exceeds limit' , async ( ) => {
146+ const tooManyCategories = Array . from ( { length : 31 } , ( _ , index ) => `cat${ index } ` ) . join ( ',' ) ;
147+ const res = await request ( app ) . get ( `/v1/technologies?category=${ encodeURIComponent ( tooManyCategories ) } ` ) ;
148+
149+ expect ( res . statusCode ) . toEqual ( 400 ) ;
150+ expect ( res . body ) . toHaveProperty ( 'errors' ) ;
151+ expect ( res . body . errors [ 0 ] ) . toHaveProperty ( 'error' ) ;
152+ expect ( res . body . errors [ 0 ] . error ) . toContain ( 'Too many values specified for category' ) ;
153+ } ) ;
154+
145155 it ( 'should handle CORS preflight requests' , async ( ) => {
146156 const res = await request ( app )
147157 . options ( '/v1/technologies' )
@@ -471,25 +481,25 @@ describe('API Routes', () => {
471481 } ) ;
472482
473483 describe ( 'Blocked paths (crawls and results)' , ( ) => {
474- it ( 'should block access to crawls paths with 403 ' , async ( ) => {
484+ it ( 'should block access to crawls paths with 400 ' , async ( ) => {
475485 const res = await request ( app )
476486 . get ( '/v1/static/crawls/chrome-Jan_1_2026/260113_Dx1LM_CCNR1.har.gz' )
477- . expect ( 403 ) ;
478- expect ( res . body ) . toHaveProperty ( 'error' , 'Access denied ' ) ;
487+ . expect ( 400 ) ;
488+ expect ( res . body ) . toHaveProperty ( 'error' , 'Not supported. Response size too large. ' ) ;
479489 } ) ;
480490
481- it ( 'should block access to results paths with 403 ' , async ( ) => {
491+ it ( 'should block access to results paths with 400 ' , async ( ) => {
482492 const res = await request ( app )
483493 . get ( '/v1/static/results/250114_Dx0_1.zip' )
484- . expect ( 403 ) ;
485- expect ( res . body ) . toHaveProperty ( 'error' , 'Access denied ' ) ;
494+ . expect ( 400 ) ;
495+ expect ( res . body ) . toHaveProperty ( 'error' , 'Not supported. Response size too large. ' ) ;
486496 } ) ;
487497
488498 it ( 'should block crawls paths at any depth' , async ( ) => {
489499 const res = await request ( app )
490500 . get ( '/v1/static/crawls/some/nested/path/file.tar.gz' )
491- . expect ( 403 ) ;
492- expect ( res . body ) . toHaveProperty ( 'error' , 'Access denied ' ) ;
501+ . expect ( 400 ) ;
502+ expect ( res . body ) . toHaveProperty ( 'error' , 'Not supported. Response size too large. ' ) ;
493503 } ) ;
494504
495505 it ( 'should allow other paths like reports' , async ( ) => {
0 commit comments