func isJSONMediaType(header http.Header) bool {
	contentType := header.Get("Content-Type")
	mediaType, _, _ := mime.ParseMediaType(contentType)
	m := strings.TrimPrefix(mediaType, "application/")
	if len(m) == len(mediaType) {
		return false
	}
	// Look for +json suffix. See https://tools.ietf.org/html/rfc6838#section-4.2.8
	// We recognize multiple suffixes too (e.g. application/something+json+other)
	// as that seems to be a possibility.
	for {
		i := strings.Index(m, "+")
		if i == -1 {
			return m == "json"
		}
		if m[0:i] == "json" {
			return true
		}
		m = m[i+1:]
	}
}
// isJSONMediaType reports whether the content type of the given header implies
// that the content is JSON.
isJSONMediaType reports whether the content type of the given header implies
that the content is JSON.
// isJSONMediaType reports whether the content type of the given header implies // that the content is JSON .
func isJSONMediaType(header http.Header) bool {
	contentType := header.Get("Content-Type")
	mediaType, _, _ := mime.ParseMediaType(contentType)
	m := strings.TrimPrefix(mediaType, "application/")
	if len(m) == len(mediaType) {
		return false
	}
	for {
		i := strings.Index(m, "+")
		if i == -1 {
			return m == "json"
		}
		if m[0:i] == "json" {
			return true
		}
		m = m[i+1:]
	}
}
func isJSONMediaType ( header http . Header ) bool { contentType := header . Get ( " " ) mediaType , _ , _ := mime . ParseMediaType ( contentType ) m := strings . TrimPrefix ( mediaType , " " ) if len ( m ) == len ( mediaType ) { return false } for { i := strings . Index ( m , " " ) if i == - 1 { return m == " " } if m [ 0 : i ] == " " { return true } m = m [ i + 1 : ] } }
isJSONMediaType reports whether the content type of the given header implies
that the content is JSON.
isJSONMediaType reports whether the content type of the given header implies that the content is JSON .
// Look for +json suffix. See https://tools.ietf.org/html/rfc6838#section-4.2.8 // We recognize multiple suffixes too (e.g. application/something+json+other) // as that seems to be a possibility.