Explorar el Código

Add WriteRedirect helper func

master
Matt Baer hace 7 años
padre
commit
b97c7b280f
Se han modificado 1 ficheros con 7 adiciones y 0 borrados
  1. +7
    -0
      response.go

+ 7
- 0
response.go Ver fichero

@@ -59,3 +59,10 @@ func WriteError(w http.ResponseWriter, e HTTPError) error {
}
return renderJSON(w, env, e.Status)
}

// WriteRedirect sends a redirect
func WriteRedirect(w http.ResponseWriter, e HTTPError) int {
w.Header().Set("Location", e.Message)
w.WriteHeader(e.Status)
return e.Status
}

Cargando…
Cancelar
Guardar