From 545d52c8aa41cb699587af5f50d246a6feb48c14 Mon Sep 17 00:00:00 2001 From: Kevin McConnell Date: Tue, 7 Jan 2025 09:06:02 +0000 Subject: [PATCH] Tidy up a test --- internal/server/service_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/server/service_test.go b/internal/server/service_test.go index 2e10b0f..54b26d6 100644 --- a/internal/server/service_test.go +++ b/internal/server/service_test.go @@ -24,7 +24,7 @@ func TestService_ServeRequest(t *testing.T) { require.Equal(t, http.StatusOK, w.Result().StatusCode) } -func TestService_RedirectToHTTPWhenTLSRequired(t *testing.T) { +func TestService_RedirectToHTTPSWhenTLSRequired(t *testing.T) { service := testCreateService(t, []string{"example.com"}, ServiceOptions{TLSEnabled: true}, defaultTargetOptions) require.True(t, service.options.TLSEnabled) @@ -34,6 +34,7 @@ func TestService_RedirectToHTTPWhenTLSRequired(t *testing.T) { service.ServeHTTP(w, req) require.Equal(t, http.StatusMovedPermanently, w.Result().StatusCode) + require.Equal(t, "https://example.com/", w.Result().Header.Get("Location")) req = httptest.NewRequest(http.MethodGet, "https://example.com", nil) w = httptest.NewRecorder()