mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 18:35:44 +03:00
Infer content type in alloc fs stat endpoint
This commit is contained in:
@@ -472,3 +472,18 @@ func TestPathFuncs(t *testing.T) {
|
||||
t.Errorf("%q is not empty. empty=%v error=%v", dir, empty, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAllocDir_DetectContentType(t *testing.T) {
|
||||
require := require.New(t)
|
||||
imgPath := "input/image.png"
|
||||
fileInfo, err := os.Stat(imgPath)
|
||||
require.Nil(err)
|
||||
res := detectContentType(fileInfo, imgPath)
|
||||
require.Equal("image/png", res)
|
||||
|
||||
jsonPath := "input/test.json"
|
||||
fileInfo, err = os.Stat(jsonPath)
|
||||
require.Nil(err)
|
||||
res = detectContentType(fileInfo, jsonPath)
|
||||
require.Equal("application/json", res)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user