// GetRegistry returns a registry instance for the current request. func GetRegistry(r *http.Request) *Registry { registry := context.Get(r, registryKey) if registry != nil { return registry.(*Registry) } newRegistry := &Registry{ request: r, sessions: make(map[string]sessionInfo), } context.Set(r, registryKey, newRegistry) return newRegistry }
// envError stores a CSRF error in the request context. func EnvError(r *http.Request, err error) { context.Set(r, ErrorKey, err) }