Skip to content

Commit

Permalink
Make test compatible with old go versions.
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Pivotto <[email protected]>
  • Loading branch information
roidelapluie committed Feb 24, 2021
1 parent b2d760b commit 062d0d0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions config/http_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
}
},
}, {
Expand All @@ -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)
}
},
},
Expand Down

0 comments on commit 062d0d0

Please sign in to comment.