(t *testing.T)
| 69 | } |
| 70 | |
| 71 | func TestIsJSONContentType(t *testing.T) { |
| 72 | tests := []struct { |
| 73 | ct string |
| 74 | want bool |
| 75 | }{ |
| 76 | {"application/json", true}, |
| 77 | {"application/json; charset=utf-8", true}, |
| 78 | {"text/json", true}, |
| 79 | {"application/octet-stream", false}, |
| 80 | {"image/png", false}, |
| 81 | {"text/html", false}, |
| 82 | {"", false}, |
| 83 | } |
| 84 | for _, tt := range tests { |
| 85 | if got := IsJSONContentType(tt.ct); got != tt.want { |
| 86 | t.Errorf("IsJSONContentType(%q) = %v, want %v", tt.ct, got, tt.want) |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | func TestMimeToExt(t *testing.T) { |
| 92 | tests := []struct { |
nothing calls this directly
no test coverage detected