Commit e4569081 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Remove unnecessary function

parent d55aa579
...@@ -39,19 +39,18 @@ type Upstream struct { ...@@ -39,19 +39,18 @@ type Upstream struct {
} }
func (u *Upstream) URLPrefix() urlprefix.Prefix { func (u *Upstream) URLPrefix() urlprefix.Prefix {
u.configureURLPrefixOnce.Do(u.configureURLPrefix) u.configureURLPrefixOnce.Do(func() {
return u.urlPrefix if u.Backend == nil {
} u.Backend = DefaultBackend
}
relativeURLRoot := u.Backend.Path
if !strings.HasSuffix(relativeURLRoot, "/") {
relativeURLRoot += "/"
}
u.urlPrefix = urlprefix.Prefix(relativeURLRoot)
})
func (u *Upstream) configureURLPrefix() { return u.urlPrefix
if u.Backend == nil {
u.Backend = DefaultBackend
}
relativeURLRoot := u.Backend.Path
if !strings.HasSuffix(relativeURLRoot, "/") {
relativeURLRoot += "/"
}
u.urlPrefix = urlprefix.Prefix(relativeURLRoot)
} }
func (u *Upstream) RoundTripper() *badgateway.RoundTripper { func (u *Upstream) RoundTripper() *badgateway.RoundTripper {
...@@ -61,6 +60,7 @@ func (u *Upstream) RoundTripper() *badgateway.RoundTripper { ...@@ -61,6 +60,7 @@ func (u *Upstream) RoundTripper() *badgateway.RoundTripper {
ResponseHeaderTimeout: u.ResponseHeaderTimeout, ResponseHeaderTimeout: u.ResponseHeaderTimeout,
} }
}) })
return u.roundtripper return u.roundtripper
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment