Skip to content

Commit 2ef7cdb

Browse files
committed
Test downloading off redirects
1 parent b019d90 commit 2ef7cdb

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

storage/storage_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,26 @@ func TestReadVSIX(t *testing.T) {
205205
rw.Header().Set("Content-Length", "1")
206206
},
207207
},
208+
{
209+
name: "Redirect",
210+
expected: testutil.Extensions[0],
211+
handler: func(rw http.ResponseWriter, r *http.Request) {
212+
if r.URL.Path == "/redirected" {
213+
vsix := testutil.CreateVSIXFromExtension(t, testutil.Extensions[0])
214+
_, err := rw.Write(vsix)
215+
require.NoError(t, err)
216+
} else {
217+
http.Redirect(rw, r, "/redirected", http.StatusFound)
218+
}
219+
},
220+
},
221+
{
222+
name: "InfiniteRedirects",
223+
error: "stopped after 10 redirects",
224+
handler: func(rw http.ResponseWriter, r *http.Request) {
225+
http.Redirect(rw, r, ".", http.StatusFound)
226+
},
227+
},
208228
}
209229

210230
for _, test := range tests {

0 commit comments

Comments
 (0)