added proxy-http-version annotation to override the HTTP/1.1 default connection type to reverse proxy backends

This commit is contained in:
E. Stuart Hicks 2019-07-08 14:32:00 -04:00
parent 1387f7b7eb
commit 3b0c523e49
8 changed files with 54 additions and 3 deletions

View file

@ -81,6 +81,7 @@ func (m mockBackend) GetDefaultBackend() defaults.Backend {
ProxyNextUpstreamTries: 3,
ProxyRequestBuffering: "on",
ProxyBuffering: "off",
ProxyHTTPVersion: "1.1",
}
}
@ -99,6 +100,7 @@ func TestProxy(t *testing.T) {
data[parser.GetAnnotationWithPrefix("proxy-next-upstream-tries")] = "3"
data[parser.GetAnnotationWithPrefix("proxy-request-buffering")] = "off"
data[parser.GetAnnotationWithPrefix("proxy-buffering")] = "on"
data[parser.GetAnnotationWithPrefix("proxy-http-version")] = "1.0"
ing.SetAnnotations(data)
i, err := NewParser(mockBackend{}).Parse(ing)
@ -142,6 +144,9 @@ func TestProxy(t *testing.T) {
if p.ProxyBuffering != "on" {
t.Errorf("expected on as proxy-buffering but returned %v", p.ProxyBuffering)
}
if p.ProxyHTTPVersion != "1.0" {
t.Errorf("expected 1.0 as proxy-http-version but returned %v", p.ProxyHTTPVersion)
}
}
func TestProxyWithNoAnnotation(t *testing.T) {
@ -188,4 +193,7 @@ func TestProxyWithNoAnnotation(t *testing.T) {
if p.RequestBuffering != "on" {
t.Errorf("expected on as request-buffering but returned %v", p.RequestBuffering)
}
if p.ProxyHTTPVersion != "1.1" {
t.Errorf("expected 1.1 as proxy-http-version but returned %v", p.ProxyHTTPVersion)
}
}