You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
466 B
24 lines
466 B
4 years ago
|
package http
|
||
|
|
||
|
import "testing"
|
||
|
|
||
|
func TestSubtype(t *testing.T) {
|
||
|
tests := []struct {
|
||
|
input string
|
||
|
expected string
|
||
|
}{
|
||
|
{"application/json", "json"},
|
||
|
{"application/json;", "json"},
|
||
|
{"application/json; charset=utf-8", "json"},
|
||
|
{"application/", ""},
|
||
|
{"application", ""},
|
||
|
{"foo", ""},
|
||
|
{"", ""},
|
||
|
}
|
||
|
for _, test := range tests {
|
||
|
if contentSubtype(test.input) != test.expected {
|
||
|
t.Errorf("expected %s got %s", test.expected, test.input)
|
||
|
}
|
||
|
}
|
||
|
}
|