|
|
@ -77,7 +77,7 @@ func TestObjectLocation(t *testing.T) { |
|
|
|
// Server with virtual domain name.
|
|
|
|
// Server with virtual domain name.
|
|
|
|
{ |
|
|
|
{ |
|
|
|
request: &http.Request{ |
|
|
|
request: &http.Request{ |
|
|
|
Host: "mys3.bucket.org", |
|
|
|
Host: "mybucket.mys3.bucket.org", |
|
|
|
Header: map[string][]string{}, |
|
|
|
Header: map[string][]string{}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
domains: []string{"mys3.bucket.org"}, |
|
|
|
domains: []string{"mys3.bucket.org"}, |
|
|
@ -87,7 +87,7 @@ func TestObjectLocation(t *testing.T) { |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
request: &http.Request{ |
|
|
|
request: &http.Request{ |
|
|
|
Host: "mys3.bucket.org", |
|
|
|
Host: "mybucket.mys3.bucket.org", |
|
|
|
Header: map[string][]string{ |
|
|
|
Header: map[string][]string{ |
|
|
|
"X-Forwarded-Scheme": {httpsScheme}, |
|
|
|
"X-Forwarded-Scheme": {httpsScheme}, |
|
|
|
}, |
|
|
|
}, |
|
|
@ -98,11 +98,14 @@ func TestObjectLocation(t *testing.T) { |
|
|
|
expectedLocation: "https://mybucket.mys3.bucket.org/test/1.txt", |
|
|
|
expectedLocation: "https://mybucket.mys3.bucket.org/test/1.txt", |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
for i, testCase := range testCases { |
|
|
|
for _, testCase := range testCases { |
|
|
|
gotLocation := getObjectLocation(testCase.request, testCase.domains, testCase.bucket, testCase.object) |
|
|
|
testCase := testCase |
|
|
|
if testCase.expectedLocation != gotLocation { |
|
|
|
t.Run("", func(t *testing.T) { |
|
|
|
t.Errorf("Test %d: expected %s, got %s", i+1, testCase.expectedLocation, gotLocation) |
|
|
|
gotLocation := getObjectLocation(testCase.request, testCase.domains, testCase.bucket, testCase.object) |
|
|
|
} |
|
|
|
if testCase.expectedLocation != gotLocation { |
|
|
|
|
|
|
|
t.Errorf("expected %s, got %s", testCase.expectedLocation, gotLocation) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|