1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-01-07 23:02:12 +02:00
kratos/transport/http/default_test.go
2021-02-20 18:43:36 +08:00

24 lines
466 B
Go

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)
}
}
}