@@ -63,7 +63,7 @@ describe('proxy route filter middleware', () => {
6363 . set ( 'user-agent' , 'git/2.42.0' )
6464 . set ( 'accept' , 'application/x-git-upload-pack-request' ) ;
6565
66- expect ( res ) . to . have . status ( 400 ) ;
66+ expect ( res ) . to . have . status ( 200 ) ; // status 200 is used to ensure error message is rendered by git client
6767 expect ( res . text ) . to . contain ( 'Invalid request received' ) ;
6868 } ) ;
6969
@@ -82,7 +82,7 @@ describe('proxy route filter middleware', () => {
8282 . send ( Buffer . from ( '0000' ) )
8383 . buffer ( ) ;
8484
85- expect ( res . status ) . to . equal ( 403 ) ;
85+ expect ( res . status ) . to . equal ( 200 ) ; // status 200 is used to ensure error message is rendered by git client
8686 expect ( res . text ) . to . contain ( 'You shall not push!' ) ;
8787 expect ( res . headers [ 'content-type' ] ) . to . include ( 'application/x-git-receive-pack-result' ) ;
8888 expect ( res . headers [ 'x-frame-options' ] ) . to . equal ( 'DENY' ) ;
@@ -466,7 +466,8 @@ describe('proxy express application', async () => {
466466 . set ( 'accept' , 'application/x-git-upload-pack-request' )
467467 . buffer ( ) ;
468468
469- res2 . should . have . status ( 403 ) ;
469+ res2 . should . have . status ( 200 ) ; // status 200 is used to ensure error message is rendered by git client
470+ expect ( res2 . text ) . to . contain ( 'Rejecting repo' ) ;
470471 } ) . timeout ( 5000 ) ;
471472
472473 it ( 'should not proxy requests for an unknown project' , async function ( ) {
@@ -487,7 +488,8 @@ describe('proxy express application', async () => {
487488 . set ( 'user-agent' , 'git/2.42.0' )
488489 . set ( 'accept' , 'application/x-git-upload-pack-request' )
489490 . buffer ( ) ;
490- res . should . have . status ( 403 ) ;
491+ res . should . have . status ( 200 ) ; // status 200 is used to ensure error message is rendered by git client
492+ expect ( res . text ) . to . contain ( 'Rejecting repo' ) ;
491493
492494 // try (and fail) to proxy a request to the repo via the fallback URL directly
493495 const res2 = await chai
@@ -496,6 +498,7 @@ describe('proxy express application', async () => {
496498 . set ( 'user-agent' , 'git/2.42.0' )
497499 . set ( 'accept' , 'application/x-git-upload-pack-request' )
498500 . buffer ( ) ;
499- res2 . should . have . status ( 403 ) ;
501+ res2 . should . have . status ( 200 ) ;
502+ expect ( res2 . text ) . to . contain ( 'Rejecting repo' ) ;
500503 } ) . timeout ( 5000 ) ;
501504} ) ;
0 commit comments