mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2026-10-22 04:32:02 +02:00
rename Upstreams to UpstreamConfig and its Configs member to Upstreams then
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user