MCPcopy Create free account
hub / github.com/coder/coder / parseMediaType

Function parseMediaType

coderd/x/chatd/chatdebug/transport.go:385–391  ·  view source on GitHub ↗

parseMediaType extracts the media type from a Content-Type header value, falling back to splitting on ";" when mime.ParseMediaType fails.

(contentType string)

Source from the content-addressed store, hash-verified

383// value, falling back to splitting on ";" when mime.ParseMediaType
384// fails.
385func 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
393func isJSONLikeContentType(contentType string) bool {
394 mediaType := parseMediaType(contentType)

Callers 3

isJSONLikeContentTypeFunction · 0.85
isNDJSONContentTypeFunction · 0.85
isSSEContentTypeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected