mirror of
https://github.com/minio/minio.git
synced 2025-11-20 09:56:07 -05:00
Simplify pkg mimedb (#6549)
Content-Type resolution can now use a function `TypeByExtension(extension)` to resolve to the respective content-type.
This commit is contained in:
committed by
Nitish Tiwari
parent
f163bed40d
commit
c7722fbb1b
@@ -29,3 +29,17 @@ func TestMimeLookup(t *testing.T) {
|
||||
t.Fatalf("Invalid content type are found expected \"false\", got %t", compressible)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTypeByExtension(t *testing.T) {
|
||||
var contentType string
|
||||
// Test TypeByExtension.
|
||||
contentType = TypeByExtension(".txt")
|
||||
if contentType != "text/plain" {
|
||||
t.Fatalf("Invalid content type are found expected \"text/plain\", got %s", contentType)
|
||||
}
|
||||
// Test non-existent type resolution
|
||||
contentType = TypeByExtension(".abc")
|
||||
if contentType != "application/octet-stream" {
|
||||
t.Fatalf("Invalid content type are found expected \"application/octet-stream\", got %s", contentType)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user