rename Upstreams to UpstreamConfig and its Configs member to Upstreams then

This commit is contained in:
Fabian Stelzer
2021-09-17 12:37:57 +00:00
parent fe9159572c
commit 88f32aeaa1
14 changed files with 79 additions and 80 deletions
+2 -2
View File
@@ -22,7 +22,7 @@ type ProxyErrorHandler func(http.ResponseWriter, *http.Request, error)
// NewProxy creates a new multiUpstreamProxy that can serve requests directed to
// multiple upstreams.
func NewProxy(upstreams options.Upstreams, sigData *options.SignatureData, writer pagewriter.Writer) (http.Handler, error) {
func NewProxy(upstreams options.UpstreamConfig, sigData *options.SignatureData, writer pagewriter.Writer) (http.Handler, error) {
m := &multiUpstreamProxy{
serveMux: mux.NewRouter(),
}
@@ -31,7 +31,7 @@ func NewProxy(upstreams options.Upstreams, sigData *options.SignatureData, write
m.serveMux.UseEncodedPath()
}
for _, upstream := range sortByPathLongest(upstreams.Configs) {
for _, upstream := range sortByPathLongest(upstreams.Upstreams) {
if upstream.Static {
if err := m.registerStaticResponseHandler(upstream, writer); err != nil {
return nil, fmt.Errorf("could not register static upstream %q: %v", upstream.ID, err)
+4 -4
View File
@@ -20,7 +20,7 @@ var _ = Describe("Proxy Suite", func() {
target string
response testHTTPResponse
upstream string
upstreams options.Upstreams
upstreams options.UpstreamConfig
}
Context("multiUpstreamProxy", func() {
@@ -40,8 +40,8 @@ var _ = Describe("Proxy Suite", func() {
// Allows for specifying settings and even individual upstreams for specific tests and uses the default upstreams/configs otherwise
upstreams := in.upstreams
if len(in.upstreams.Configs) == 0 {
upstreams.Configs = []options.Upstream{
if len(in.upstreams.Upstreams) == 0 {
upstreams.Upstreams = []options.Upstream{
{
ID: "http-backend",
Path: "/http/",
@@ -325,7 +325,7 @@ var _ = Describe("Proxy Suite", func() {
upstream: "",
}),
Entry("containing an escaped '/' with ProxyRawPath", &proxyTableInput{
upstreams: options.Upstreams{ProxyRawPath: true},
upstreams: options.UpstreamConfig{ProxyRawPath: true},
target: "http://example.localhost/%2F/test1/%2F/test2",
response: testHTTPResponse{
code: 404,