From 062d0d0083ae05bc049898085881dd8626bb7716 Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Wed, 24 Feb 2021 23:22:21 +0100 Subject: [PATCH] Make test compatible with old go versions. Signed-off-by: Julien Pivotto --- config/http_config_test.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/config/http_config_test.go b/config/http_config_test.go index 9762d60a..3bd0b283 100644 --- a/config/http_config_test.go +++ b/config/http_config_test.go @@ -311,7 +311,9 @@ func TestNewClientFromConfig(t *testing.T) { case "/redirected": fmt.Fprintf(w, ExpectedMessage) default: - http.Redirect(w, r, "/redirected", http.StatusFound) + w.Header().Set("Location", "/redirected") + w.WriteHeader(http.StatusFound) + fmt.Fprintf(w, "It should follow the redirect.") } }, }, { @@ -329,9 +331,9 @@ func TestNewClientFromConfig(t *testing.T) { case "/redirected": fmt.Fprint(w, "The redirection was followed.") default: - w.Header()["Content-Type"] = nil - http.Redirect(w, r, "/redirected", http.StatusFound) - fmt.Fprint(w, ExpectedMessage) + w.Header().Set("Location", "/redirected") + w.WriteHeader(http.StatusFound) + fmt.Fprintf(w, ExpectedMessage) } }, },