Documentation ¶
Index ¶
- Variables
- func EnsureHost(host string)
- func GetSignedCookieValue(s string) string
- func GetXSRF(r *http.Request) string
- func HandleGet(pattern string, h func(http.ResponseWriter, *http.Request), opts ...Option)
- func HandlePost(pattern string, h func(http.ResponseWriter, *http.Request), opts ...Option)
- func InternalServerError(w http.ResponseWriter, err error)
- func Wildcard(r *http.Request) string
- type Option
Constants ¶
This section is empty.
Variables ¶
var IsDev bool
IsDev indicates whether we're running on a dev machine.
var Mux *goji.Mux
Mux is the root Mux for handling requests.
Functions ¶
func EnsureHost ¶
func EnsureHost(host string)
EnsureHost checks the request headers to ensure that it's an HTTPS request to the specified host. If not, it'll redirect the request to the same path on the specified host and using HTTPS. The check will also add the HSTS header for valid requests.
This function will do nothing when running on a dev machine.
func GetSignedCookieValue ¶
GetSignedCookieValue checks that the given string is appropriately signed with the secret.CookieSigningKey, that it is still valid, and returns the unpacked value.
func GetXSRF ¶
GetXSRF returns the XSRF value from the given request. It returns an empty string if the value doesn't exist or is invalid.
func HandlePost ¶
HandlePost adds a new POST route to the root Mux.
func InternalServerError ¶
func InternalServerError(w http.ResponseWriter, err error)
InternalServerError sets the http 500 status code.
Types ¶
type Option ¶
type Option func(*cfg)
Option represents a middleware option.
func PrivateCache ¶
PrivateCache will set private cache headers on a successful response.
func PublicCache ¶
PublicCache will set public cache headers on a successful response.