summaryrefslogtreecommitdiff
path: root/redirect.go
diff options
context:
space:
mode:
Diffstat (limited to 'redirect.go')
-rw-r--r--redirect.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/redirect.go b/redirect.go
new file mode 100644
index 0000000..a392234
--- /dev/null
+++ b/redirect.go
@@ -0,0 +1,8 @@
+package mux
+
+import "net/http"
+
+func Redirect(w http.ResponseWriter, code int, location string) {
+ w.Header().Add("Location", location)
+ w.WriteHeader(code)
+}