// GetRedirectUrl returns the redirect url with all query string parameters
183737
func (r *Response) GetRedirectUrl() (string, error) {
	if r.Type != REDIRECT {
		return "", errors.New("Not a redirect response")
	}

	u, err := url.Parse(r.URL)
	if err != nil {
		return "", err
	}

	var q url.Values
	if r.RedirectInFragment {
		// start with empty set for fragment
		q = url.Values{}
	} else {
		// add parameters to existing query
		q = u.Query()
	}

	// add parameters
	for n, v := range r.Output {
		q.Set(n, fmt.Sprint(v))
	}

	// https://tools.ietf.org/html/rfc6749#section-4.2.2
	// Fragment should be encoded as application/x-www-form-urlencoded (%-escaped, spaces are represented as '+')
	// The stdlib URL#String() doesn't make that easy to accomplish, so build this ourselves
	if r.RedirectInFragment {
		u.Fragment = ""
		redirectURI := u.String() + "#" + q.Encode()
		return redirectURI, nil
	}

	// Otherwise, update the query and encode normally
	u.RawQuery = q.Encode()
	u.Fragment = ""
	return u.String(), nil
}
522859
func (m *Membership) GetURL() string {
	if m == nil || m.URL == nil {
		return ""
	}
	return *m.URL
}
599007
func (s *Subscription) GetURL() string {
	if s == nil || s.URL == nil {
		return ""
	}
	return *s.URL
}
98138
func (l *LabelResult) GetURL() string {
	if l == nil || l.URL == nil {
		return ""
	}
	return *l.URL
}
158094
func (g *Grant) GetURL() string {
	if g == nil || g.URL == nil {
		return ""
	}
	return *g.URL
}
886387
func (d *Deployment) GetURL() string {
	if d == nil || d.URL == nil {
		return ""
	}
	return *d.URL
}
1163232
func (oauth *Oauth) Redirect(writer http.ResponseWriter, req *http.Request, redirectURI, scope, state string) error {
	location, err := oauth.GetRedirectURL(redirectURI, scope, state)
	if err != nil {
		return err
	}
	http.Redirect(writer, req, location, 302)
	return nil
}
1248551
func (c *Registry) GetValidRedirectURLs(req *http.Request) (string, error) {
	if c.v.IsSet(varValidRedirectURLs) {
		return c.v.GetString(varValidRedirectURLs), nil
	}
	if c.IsPostgresDeveloperModeEnabled() {
		return devModeValidRedirectURLs, nil
	}
	return c.checkLocalhostRedirectException(req)
}
788033
func (h *Hook) GetURL() string {
	if h == nil || h.URL == nil {
		return ""
	}
	return *h.URL
}
178875
func (r *RepositoryCommit) GetURL() string {
	if r == nil || r.URL == nil {
		return ""
	}
	return *r.URL
}
309251
func (m *Migration) GetURL() string {
	if m == nil || m.URL == nil {
		return ""
	}
	return *m.URL
}
647614
func (k *Key) GetURL() string {
	if k == nil || k.URL == nil {
		return ""
	}
	return *k.URL
}
82749
func (r *RepoStatus) GetURL() string {
	if r == nil || r.URL == nil {
		return ""
	}
	return *r.URL
}
992299
func (c *Contributor) GetURL() string {
	if c == nil || c.URL == nil {
		return ""
	}
	return *c.URL
}
163288
func (p *PagesBuild) GetURL() string {
	if p == nil || p.URL == nil {
		return ""
	}
	return *p.URL
}
459316
func WWWRedirect() Middleware {
	return func(h http.Handler) http.Handler {
		return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
			if !strings.HasPrefix(r.Host, "www.") {
				http.Redirect(w, r, scheme(r)+"://www."+r.Host+r.RequestURI, http.StatusMovedPermanently)
				return
			}
			h.ServeHTTP(w, r)
		})
	}
}
52442
func (ar *AuthenticationRedirectors) Get(name string) (AuthenticationRedirector, bool) {
	val, exists := ar.redirectorMap[name]
	return val, exists
}