@@ -60,6 +60,7 @@ func TestLegacyFullCycle(t *testing.T) {
6060 // 2. Upload file
6161 req , _ := http .NewRequest ("PUT" , uploadURL + "?itemPath=data/file.txt" , bytes .NewReader (fileContent ))
6262 req .Header .Set ("Content-Type" , "application/octet-stream" )
63+ req .Header .Set ("Authorization" , "Bearer test-token" )
6364 uploadResp , err := http .DefaultClient .Do (req )
6465 if err != nil {
6566 t .Fatalf ("upload: %v" , err )
@@ -115,7 +116,9 @@ func TestLegacyFullCycle(t *testing.T) {
115116 contentLocation := filesResult .Value [0 ]["contentLocation" ].(string )
116117
117118 // 6. Download file
118- dlResp , err := http .Get (contentLocation )
119+ dlReq , _ := http .NewRequest ("GET" , contentLocation , nil )
120+ dlReq .Header .Set ("Authorization" , "Bearer test-token" )
121+ dlResp , err := http .DefaultClient .Do (dlReq )
119122 if err != nil {
120123 t .Fatalf ("download: %v" , err )
121124 }
@@ -148,6 +151,7 @@ func TestLegacyChunkedUpload(t *testing.T) {
148151 // Upload chunk 1
149152 req , _ := http .NewRequest ("PUT" , uploadURL + "?itemPath=file.bin" , bytes .NewReader (chunk1 ))
150153 req .Header .Set ("Content-Range" , fmt .Sprintf ("bytes 0-%d/%d" , len (chunk1 )- 1 , total ))
154+ req .Header .Set ("Authorization" , "Bearer test-token" )
151155 r , _ := http .DefaultClient .Do (req )
152156 r .Body .Close ()
153157 if r .StatusCode != http .StatusCreated {
@@ -157,6 +161,7 @@ func TestLegacyChunkedUpload(t *testing.T) {
157161 // Upload chunk 2
158162 req , _ = http .NewRequest ("PUT" , uploadURL + "?itemPath=file.bin" , bytes .NewReader (chunk2 ))
159163 req .Header .Set ("Content-Range" , fmt .Sprintf ("bytes %d-%d/%d" , len (chunk1 ), total - 1 , total ))
164+ req .Header .Set ("Authorization" , "Bearer test-token" )
160165 r , _ = http .DefaultClient .Do (req )
161166 r .Body .Close ()
162167 if r .StatusCode != http .StatusCreated {
@@ -184,7 +189,9 @@ func TestLegacyChunkedUpload(t *testing.T) {
184189 resp .Body .Close ()
185190 contentLocation := filesResult .Value [0 ]["contentLocation" ].(string )
186191
187- dlResp , _ := http .Get (contentLocation )
192+ dlReq , _ := http .NewRequest ("GET" , contentLocation , nil )
193+ dlReq .Header .Set ("Authorization" , "Bearer test-token" )
194+ dlResp , _ := http .DefaultClient .Do (dlReq )
188195 defer dlResp .Body .Close ()
189196 data , _ := io .ReadAll (dlResp .Body )
190197 expected := append (chunk1 , chunk2 ... )
@@ -215,6 +222,7 @@ func TestLegacyGzipRoundtrip(t *testing.T) {
215222 // Upload with Content-Encoding: gzip
216223 req , _ := http .NewRequest ("PUT" , uploadURL + "?itemPath=data.gz" , bytes .NewReader (gzipData ))
217224 req .Header .Set ("Content-Encoding" , "gzip" )
225+ req .Header .Set ("Authorization" , "Bearer test-token" )
218226 r , _ := http .DefaultClient .Do (req )
219227 r .Body .Close ()
220228 if r .StatusCode != http .StatusCreated {
@@ -239,7 +247,9 @@ func TestLegacyGzipRoundtrip(t *testing.T) {
239247 // Use raw HTTP transport to avoid automatic decompression
240248 transport := & http.Transport {DisableCompression : true }
241249 client := & http.Client {Transport : transport }
242- dlResp , _ := client .Get (filesResult .Value [0 ]["contentLocation" ].(string ))
250+ dlReq , _ := http .NewRequest ("GET" , filesResult .Value [0 ]["contentLocation" ].(string ), nil )
251+ dlReq .Header .Set ("Authorization" , "Bearer test-token" )
252+ dlResp , _ := client .Do (dlReq )
243253 defer dlResp .Body .Close ()
244254
245255 if dlResp .Header .Get ("Content-Encoding" ) != "gzip" {
@@ -272,6 +282,7 @@ func TestLegacyMultipleFiles(t *testing.T) {
272282
273283 for path , content := range files {
274284 req , _ := http .NewRequest ("PUT" , uploadURL + "?itemPath=" + path , bytes .NewReader ([]byte (content )))
285+ req .Header .Set ("Authorization" , "Bearer test-token" )
275286 r , _ := http .DefaultClient .Do (req )
276287 r .Body .Close ()
277288 }
@@ -319,14 +330,14 @@ func TestLegacyNotFound(t *testing.T) {
319330 }
320331
321332 // Download non-existent container
322- dlResp , _ := http . Get ( ts . URL + "/download-v3/9999" )
333+ dlResp := legacyRequest ( t , ts , "GET" , "/download-v3/9999" , nil )
323334 dlResp .Body .Close ()
324335 if dlResp .StatusCode != http .StatusNotFound {
325336 t .Fatalf ("expected 404, got %d" , dlResp .StatusCode )
326337 }
327338
328339 // Download non-existent file
329- dlResp , _ = http . Get ( ts . URL + "/artifact/9999/nofile.txt" )
340+ dlResp = legacyRequest ( t , ts , "GET" , "/artifact/9999/nofile.txt" , nil )
330341 dlResp .Body .Close ()
331342 if dlResp .StatusCode != http .StatusNotFound {
332343 t .Fatalf ("expected 404, got %d" , dlResp .StatusCode )
0 commit comments