@@ -63,7 +63,7 @@ describe('proxy route filter middleware', () => {
63
63
. set ( 'user-agent' , 'git/2.42.0' )
64
64
. set ( 'accept' , 'application/x-git-upload-pack-request' ) ;
65
65
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
67
67
expect ( res . text ) . to . contain ( 'Invalid request received' ) ;
68
68
} ) ;
69
69
@@ -82,7 +82,7 @@ describe('proxy route filter middleware', () => {
82
82
. send ( Buffer . from ( '0000' ) )
83
83
. buffer ( ) ;
84
84
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
86
86
expect ( res . text ) . to . contain ( 'You shall not push!' ) ;
87
87
expect ( res . headers [ 'content-type' ] ) . to . include ( 'application/x-git-receive-pack-result' ) ;
88
88
expect ( res . headers [ 'x-frame-options' ] ) . to . equal ( 'DENY' ) ;
@@ -466,7 +466,8 @@ describe('proxy express application', async () => {
466
466
. set ( 'accept' , 'application/x-git-upload-pack-request' )
467
467
. buffer ( ) ;
468
468
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' ) ;
470
471
} ) . timeout ( 5000 ) ;
471
472
472
473
it ( 'should not proxy requests for an unknown project' , async function ( ) {
@@ -487,7 +488,8 @@ describe('proxy express application', async () => {
487
488
. set ( 'user-agent' , 'git/2.42.0' )
488
489
. set ( 'accept' , 'application/x-git-upload-pack-request' )
489
490
. 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' ) ;
491
493
492
494
// try (and fail) to proxy a request to the repo via the fallback URL directly
493
495
const res2 = await chai
@@ -496,6 +498,7 @@ describe('proxy express application', async () => {
496
498
. set ( 'user-agent' , 'git/2.42.0' )
497
499
. set ( 'accept' , 'application/x-git-upload-pack-request' )
498
500
. buffer ( ) ;
499
- res2 . should . have . status ( 403 ) ;
501
+ res2 . should . have . status ( 200 ) ;
502
+ expect ( res2 . text ) . to . contain ( 'Rejecting repo' ) ;
500
503
} ) . timeout ( 5000 ) ;
501
504
} ) ;
0 commit comments