@@ -42,9 +42,10 @@ describe('proxy route filter middleware', () => {
4242
4343 const res = await chai
4444 . request ( app )
45- . get ( '/owner/repo.git/info/refs?service= git-upload-pack' )
45+ . post ( '/owner/repo.git/git-upload-pack' )
4646 . set ( 'user-agent' , 'git/2.42.0' )
4747 . set ( 'accept' , 'application/x-git-upload-pack-request' )
48+ . send ( Buffer . from ( '0000' ) )
4849 . buffer ( ) ;
4950
5051 expect ( res . status ) . to . equal ( 200 ) ;
@@ -112,49 +113,49 @@ describe('proxy route helpers', () => {
112113 } ) ;
113114 expect ( res ) . to . be . true ;
114115 } ) ;
115-
116+
116117 it ( 'should return true for /info/refs?service=git-receive-pack with valid user-agent' , ( ) => {
117118 const res = validGitRequest ( '/info/refs?service=git-receive-pack' , {
118119 'user-agent' : 'git/1.9.1' ,
119120 } ) ;
120121 expect ( res ) . to . be . true ;
121122 } ) ;
122-
123+
123124 it ( 'should return false for /info/refs?service=git-upload-pack with missing user-agent' , ( ) => {
124125 const res = validGitRequest ( '/info/refs?service=git-upload-pack' , { } ) ;
125126 expect ( res ) . to . be . false ;
126127 } ) ;
127-
128+
128129 it ( 'should return false for /info/refs?service=git-upload-pack with non-git user-agent' , ( ) => {
129130 const res = validGitRequest ( '/info/refs?service=git-upload-pack' , {
130131 'user-agent' : 'curl/7.79.1' ,
131132 } ) ;
132133 expect ( res ) . to . be . false ;
133134 } ) ;
134-
135+
135136 it ( 'should return true for /git-upload-pack with valid user-agent and accept' , ( ) => {
136137 const res = validGitRequest ( '/git-upload-pack' , {
137138 'user-agent' : 'git/2.40.0' ,
138139 accept : 'application/x-git-upload-pack-request' ,
139140 } ) ;
140141 expect ( res ) . to . be . true ;
141142 } ) ;
142-
143+
143144 it ( 'should return false for /git-upload-pack with missing accept header' , ( ) => {
144145 const res = validGitRequest ( '/git-upload-pack' , {
145146 'user-agent' : 'git/2.40.0' ,
146147 } ) ;
147148 expect ( res ) . to . be . false ;
148149 } ) ;
149-
150+
150151 it ( 'should return false for /git-upload-pack with wrong accept header' , ( ) => {
151152 const res = validGitRequest ( '/git-upload-pack' , {
152153 'user-agent' : 'git/2.40.0' ,
153154 accept : 'application/json' ,
154155 } ) ;
155156 expect ( res ) . to . be . false ;
156157 } ) ;
157-
158+
158159 it ( 'should return false for unknown paths' , ( ) => {
159160 const res = validGitRequest ( '/not-a-valid-git-path' , {
160161 'user-agent' : 'git/2.40.0' ,
@@ -169,32 +170,32 @@ describe('proxy route helpers', () => {
169170 const res = stripGitHubFromGitPath ( '/foo/bar.git/info/refs' ) ;
170171 expect ( res ) . to . equal ( '/info/refs' ) ;
171172 } ) ;
172-
173+
173174 it ( 'should strip owner and repo from a valid GitHub-style path with 5 parts' , ( ) => {
174175 const res = stripGitHubFromGitPath ( '/foo/bar.git/git-upload-pack' ) ;
175176 expect ( res ) . to . equal ( '/git-upload-pack' ) ;
176177 } ) ;
177-
178+
178179 it ( 'should return undefined for malformed path with too few segments' , ( ) => {
179180 const res = stripGitHubFromGitPath ( '/foo/bar.git' ) ;
180181 expect ( res ) . to . be . undefined ;
181182 } ) ;
182-
183+
183184 it ( 'should return undefined for malformed path with too many segments' , ( ) => {
184185 const res = stripGitHubFromGitPath ( '/foo/bar.git/extra/path/stuff' ) ;
185186 expect ( res ) . to . be . undefined ;
186187 } ) ;
187-
188+
188189 it ( 'should handle repo names that include dots correctly' , ( ) => {
189190 const res = stripGitHubFromGitPath ( '/foo/some.repo.git/info/refs' ) ;
190191 expect ( res ) . to . equal ( '/info/refs' ) ;
191192 } ) ;
192-
193+
193194 it ( 'should not break if the path is just a slash' , ( ) => {
194195 const res = stripGitHubFromGitPath ( '/' ) ;
195196 expect ( res ) . to . be . undefined ;
196197 } ) ;
197-
198+
198199 it ( 'should not break if the path is empty' , ( ) => {
199200 const res = stripGitHubFromGitPath ( '' ) ;
200201 expect ( res ) . to . be . undefined ;
0 commit comments