app/vmauth: verify how backend response headers are propagated to vmauth client

This commit is contained in:
Aliaksandr Valialkin 2024-07-27 13:44:49 +02:00
parent d53dd6ecf3
commit 83f2ce4910
No known key found for this signature in database
GPG Key ID: 52C003EE2BCDB9EB

View File

@ -71,6 +71,10 @@ unauthorized_user:
url_prefix: {BACKEND}/foo?bar=baz` url_prefix: {BACKEND}/foo?bar=baz`
requestURL := "http://some-host.com/abc/def?some_arg=some_value" requestURL := "http://some-host.com/abc/def?some_arg=some_value"
backendHandler := func(w http.ResponseWriter, r *http.Request) { backendHandler := func(w http.ResponseWriter, r *http.Request) {
h := w.Header()
h.Set("Connection", "close")
h.Set("Foo", "bar")
var bb bytes.Buffer var bb bytes.Buffer
if err := r.Header.Write(&bb); err != nil { if err := r.Header.Write(&bb); err != nil {
panic(fmt.Errorf("unexpected error when marshaling headers: %w", err)) panic(fmt.Errorf("unexpected error when marshaling headers: %w", err))
@ -79,6 +83,7 @@ unauthorized_user:
} }
responseExpected := ` responseExpected := `
statusCode=200 statusCode=200
Foo: bar
requested_url={BACKEND}/foo/abc/def?bar=baz&some_arg=some_value requested_url={BACKEND}/foo/abc/def?bar=baz&some_arg=some_value
Pass-Header: abc Pass-Header: abc
User-Agent: vmauth User-Agent: vmauth