parseMediaType extracts the media type from a Content-Type header value, falling back to splitting on ";" when mime.ParseMediaType fails.
(contentType string)
| 383 | // value, falling back to splitting on ";" when mime.ParseMediaType |
| 384 | // fails. |
| 385 | func parseMediaType(contentType string) string { |
| 386 | mediaType, _, err := mime.ParseMediaType(contentType) |
| 387 | if err != nil { |
| 388 | mediaType = strings.ToLower(strings.TrimSpace(strings.Split(contentType, ";")[0])) |
| 389 | } |
| 390 | return mediaType |
| 391 | } |
| 392 | |
| 393 | func isJSONLikeContentType(contentType string) bool { |
| 394 | mediaType := parseMediaType(contentType) |
no outgoing calls
no test coverage detected