From de889e3a7e198c6a47fa6c47a4e2526259f0ee98 Mon Sep 17 00:00:00 2001 From: GrĂ©goire DuchĂȘne Date: Sat, 4 Jun 2022 13:50:53 +0100 Subject: Fix tests --- resp_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'resp_test.go') diff --git a/resp_test.go b/resp_test.go index 434d985..2185403 100644 --- a/resp_test.go +++ b/resp_test.go @@ -14,7 +14,7 @@ func TestRedirector_ServeHTTP(t *testing.T) { r := &redirector{"src.example.com/x", "https://example.com/git", "git"} t.Run("GoVisit", func(t *testing.T) { - req := httptest.NewRequest(http.MethodGet, "https://src.example.com/foo?go-get=1", nil) + req := httptest.NewRequest(http.MethodGet, "https://src.example.com/x/foo?go-get=1", nil) w := httptest.NewRecorder() r.ServeHTTP(w, req) @@ -28,7 +28,7 @@ func TestRedirector_ServeHTTP(t *testing.T) { t.FailNow() } expected := ` - + go-import-redirect ` if string(body) != expected { @@ -40,7 +40,7 @@ func TestRedirector_ServeHTTP(t *testing.T) { }) t.Run("UserVisit", func(t *testing.T) { - req := httptest.NewRequest(http.MethodGet, "https://src.example.com/foo", nil) + req := httptest.NewRequest(http.MethodGet, "https://src.example.com/x/foo", nil) w := httptest.NewRecorder() r.ServeHTTP(w, req) @@ -51,8 +51,8 @@ func TestRedirector_ServeHTTP(t *testing.T) { if resp.ContentLength > 0 { t.Error("expected empty body") } - if hdr := resp.Header.Get("Location"); hdr != "https://pkg.go.dev/src.example.com/foo" { - t.Errorf("expected %q, got %q", "https://pkg.go.dev/src.example.com/foo", hdr) + if hdr := resp.Header.Get("Location"); hdr != "https://pkg.go.dev/src.example.com/x/foo" { + t.Errorf("expected %q, got %q", "https://pkg.go.dev/src.example.com/x/foo", hdr) } }) } -- cgit v1.2.3-70-g09d2