mirror of https://github.com/containers/image.git
25 lines
718 B
Go
25 lines
718 B
Go
package docker
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestSimplifyContentType(t *testing.T) {
|
|
for _, c := range []struct{ input, expected string }{
|
|
{"", ""},
|
|
{"application/json", "application/json"},
|
|
{"application/json;charset=utf-8", "application/json"},
|
|
{"application/json; charset=utf-8", "application/json"},
|
|
{"application/json ; charset=utf-8", "application/json"},
|
|
{"application/json\t;\tcharset=utf-8", "application/json"},
|
|
{"application/json ;charset=utf-8", "application/json"},
|
|
{`application/json; charset="utf-8"`, "application/json"},
|
|
{"completely invalid", ""},
|
|
} {
|
|
out := simplifyContentType(c.input)
|
|
assert.Equal(t, c.expected, out, c.input)
|
|
}
|
|
}
|