default_context.go
func (d *DefaultContext) Redirect(status int, url string, args ...interface{}) error {
	d.Flash().persist(d.Session())

	if strings.HasSuffix(url, "Path()") {
		if len(args) > 1 {
			return fmt.Errorf("you must pass only a map[string]interface{} to a route path: %T", args)
		}
		var m map[string]interface{}
		if len(args) == 1 {
			rv := reflect.Indirect(reflect.ValueOf(args[0]))
			if !rv.Type().ConvertibleTo(mapType) {
				return fmt.Errorf("you must pass only a map[string]interface{} to a route path: %T", args)
			}
			m = rv.Convert(mapType).Interface().(map[string]interface{})
		}
		h, ok := d.Value(strings.TrimSuffix(url, "()")).(RouteHelperFunc)
		if !ok {
			return fmt.Errorf("could not find a route helper named %s", url)
		}
		url, err := h(m)
		if err != nil {
			return err
		}
		http.Redirect(d.Response(), d.Request(), string(url), status)
		return nil
	}

	if len(args) > 0 {
		url = fmt.Sprintf(url, args...)
	}
	http.Redirect(d.Response(), d.Request(), url, status)
	return nil
}
func (d *DefaultContext) Redirect(status int, url string, args ...interface{}) error {
	d.Flash().persist(d.Session())

	if strings.HasSuffix(url, "Path()") {
		if len(args) > 1 {
			return fmt.Errorf("you must pass only a map[string]interface{} to a route path: %T", args)
		}
		var m map[string]interface{}
		if len(args) == 1 {
			rv := reflect.Indirect(reflect.ValueOf(args[0]))
			if !rv.Type().ConvertibleTo(mapType) {
				return fmt.Errorf("you must pass only a map[string]interface{} to a route path: %T", args)
			}
			m = rv.Convert(mapType).Interface().(map[string]interface{})
		}
		h, ok := d.Value(strings.TrimSuffix(url, "()")).(RouteHelperFunc)
		if !ok {
			return fmt.Errorf("could not find a route helper named %s", url)
		}
		url, err := h(m)
		if err != nil {
			return err
		}
		http.Redirect(d.Response(), d.Request(), string(url), status)
		return nil
	}

	if len(args) > 0 {
		url = fmt.Sprintf(url, args...)
	}
	http.Redirect(d.Response(), d.Request(), url, status)
	return nil
}
// Redirect a request with the given status to the given URL.