ls 4 years ago
parent
commit
d58b2a6afe
1 changed files with 5 additions and 3 deletions
  1. 5 3
      response.go

+ 5 - 3
response.go

@@ -18,9 +18,11 @@ func SetHeader(w http.ResponseWriter, key, value string) {
 }
 
 // Redirect redirect
-func Redirect(w http.ResponseWriter, url string) {
-	w.Header().Set(`Location`, url)
-	w.WriteHeader(http.StatusFound)
+func Redirect(w http.ResponseWriter, r *http.Request, url string) {
+	//w.Header().Set(`Location`, url)
+	//w.WriteHeader(http.StatusFound)
+
+	http.Redirect(w, r, url, http.StatusFound)
 }
 
 // WriteJSON response JSON data.