mirror of
https://github.com/minio/minio.git
synced 2026-02-04 18:00:15 -05:00
Virtual host style S3 requests (#5095)
This commit is contained in:
committed by
Dee Koder
parent
d57d57ddf5
commit
e7a724de0d
@@ -190,3 +190,26 @@ func TestExtractMetadataHeaders(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Test getResource()
|
||||
func TestGetResource(t *testing.T) {
|
||||
testCases := []struct {
|
||||
p string
|
||||
host string
|
||||
domain string
|
||||
expectedResource string
|
||||
}{
|
||||
{"/a/b/c", "test.mydomain.com", "mydomain.com", "/test/a/b/c"},
|
||||
{"/a/b/c", "test.mydomain.com", "notmydomain.com", "/a/b/c"},
|
||||
{"/a/b/c", "test.mydomain.com", "", "/a/b/c"},
|
||||
}
|
||||
for i, test := range testCases {
|
||||
gotResource, err := getResource(test.p, test.host, test.domain)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if gotResource != test.expectedResource {
|
||||
t.Fatalf("test %d: expected %s got %s", i+1, test.expectedResource, gotResource)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user