summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/reverseproxy/addresses_test.go
diff options
context:
space:
mode:
authorMohammed Al Sahaf <msaa1990@gmail.com>2023-08-05 23:30:02 +0200
committerGitHub <noreply@github.com>2023-08-05 23:30:02 +0200
commit65e33fc1ee4798bb3450f6e291bfc88404982636 (patch)
tree6df2a4fc05295246c3cb9ab412fbe6d2828be8fd /modules/caddyhttp/reverseproxy/addresses_test.go
parent9f34383c02f1691e54280285a6499893fcbbb4c7 (diff)
reverseproxy: do not parse upstream address too early if it contains replaceble parts (#5695)
* reverseproxy: do not parse upstream address too early if it contains replaceble parts * remove unused method * cleanup * accommodate partially replaceable port
Diffstat (limited to 'modules/caddyhttp/reverseproxy/addresses_test.go')
-rw-r--r--modules/caddyhttp/reverseproxy/addresses_test.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/modules/caddyhttp/reverseproxy/addresses_test.go b/modules/caddyhttp/reverseproxy/addresses_test.go
index 0c7ad7b..0c51419 100644
--- a/modules/caddyhttp/reverseproxy/addresses_test.go
+++ b/modules/caddyhttp/reverseproxy/addresses_test.go
@@ -265,18 +265,18 @@ func TestParseUpstreamDialAddress(t *testing.T) {
expectScheme: "h2c",
},
} {
- actualHostPort, actualScheme, err := parseUpstreamDialAddress(tc.input)
+ actualAddr, err := parseUpstreamDialAddress(tc.input)
if tc.expectErr && err == nil {
t.Errorf("Test %d: Expected error but got %v", i, err)
}
if !tc.expectErr && err != nil {
t.Errorf("Test %d: Expected no error but got %v", i, err)
}
- if actualHostPort != tc.expectHostPort {
- t.Errorf("Test %d: Expected host and port '%s' but got '%s'", i, tc.expectHostPort, actualHostPort)
+ if actualAddr.dialAddr() != tc.expectHostPort {
+ t.Errorf("Test %d: input %s: Expected host and port '%s' but got '%s'", i, tc.input, tc.expectHostPort, actualAddr.dialAddr())
}
- if actualScheme != tc.expectScheme {
- t.Errorf("Test %d: Expected scheme '%s' but got '%s'", i, tc.expectScheme, actualScheme)
+ if actualAddr.scheme != tc.expectScheme {
+ t.Errorf("Test %d: Expected scheme '%s' but got '%s'", i, tc.expectScheme, actualAddr.scheme)
}
}
}