// getContentSubtype attempts to get the content subtype.
// returns "" if no content subtype can be parsed.
964551
func getContentSubtype(contentType string) string {
	if !strings.HasPrefix(contentType, baseContentType) || len(contentType) == len(baseContentType) {
		return ""
	}
	switch contentType[len(baseContentType)] {
	case '+', ';':
		return contentType[len(baseContentType)+1:]
	default:
		return ""
	}
}
771650
func checkContentType(contentType string) error {
	if contentType == "" {
		return nil
	}

	mType, mParams, err := mime.ParseMediaType(contentType)
	if err != nil {
		return err
	}

	if mType != "text/xml" && mType != "application/xml" {
		return fmt.Errorf("unsupported content type %q", mType)
	}

	charset, _ := mParams["charset"]
	if charset != "" && strings.ToLower(charset) != "utf-8" {
		return fmt.Errorf("unsupported content charset %q", charset)
	}

	return nil
}
12910
func (t *TreeEntry) GetContent() string {
	if t == nil || t.Content == nil {
		return ""
	}
	return *t.Content
}
958331
func (e *Entry) GetContent(key string) string {
	val := e.Get(key)
	if val == nil {
		return ""
	}
	return val.Value.Content
}
705636
func (c *Connection) ObjectUpdateContentType(container string, objectName string, contentType string) (err error) {
	h := Headers{"Content-Type": contentType}
	_, err = c.ObjectCopy(container, objectName, container, objectName, h)
	return
}
177483
func (r *RepositoryContent) GetType() string {
	if r == nil || r.Type == nil {
		return ""
	}
	return *r.Type
}
421441
func (surface *Surface) GetContent() Content {
	ret := Content(C.cairo_surface_get_content(surface.Ptr))
	if err := surface.status(); err != nil {
		panic(err)
	}
	return ret
}
970263
func (s *AuthServer) getOTPType(user string) (string, error) {
	_, err := s.GetHOTP(user)
	if err != nil {
		if trace.IsNotFound(err) {
			return teleport.TOTP, nil
		}
		return "", trace.Wrap(err)
	}
	return teleport.HOTP, nil
}
1006672
func (h *HTTPBodyMarshaler) ContentTypeFromMessage(v interface{}) string {
	if httpBody, ok := v.(*httpbody.HttpBody); ok {
		return httpBody.GetContentType()
	}
	return h.Marshaler.ContentType()
}
1127439
func isContentType(h http.Header, contentType string) bool {
	ct := h.Get("Content-Type")
	if i := strings.IndexRune(ct, ';'); i != -1 {
		ct = ct[0:i]
	}
	return ct == contentType
}
1020393
func DetectContentType(fileName string, f io.ReadSeeker) (string, error) {
	ctype := mime.TypeByExtension(filepath.Ext(fileName))
	if ctype != "" {
		return ctype, nil
	}

	// save/rollback to get content probe from begin of file
	currentPosition, err := f.Seek(0, io.SeekCurrent)
	if err != nil {
		return MimeOctetStream, fmt.Errorf("seeker can't seek, %s", err)
	}

	// read a chunk to decide between utf-8 text and binary
	var buf [512]byte
	n, _ := f.Read(buf[:])
	ctype = http.DetectContentType(buf[:n])

	_, err = f.Seek(currentPosition, io.SeekStart) // rewind to output whole file
	if err != nil {
		return MimeOctetStream, fmt.Errorf("seeker can't seek, %s", err)
	}

	return ctype, nil
}
37782
func detectContentType(body interface{}) string {
	contentType := "text/plain; charset=utf-8"
	kind := reflect.TypeOf(body).Kind()
	
	switch kind {
	case reflect.Struct, reflect.Map, reflect.Ptr:
		contentType = "application/json; charset=utf-8"
	case reflect.String:
		contentType = "text/plain; charset=utf-8"
	default:
		if b, ok := body.([]byte); ok {
			contentType = http.DetectContentType(b)
		} else if kind == reflect.Slice {
			contentType = "application/json; charset=utf-8"
		}
	}

	return contentType
}
1228805
func FormatFromContentType(v string) (Format, error) {
	if v == "" {
		return FormatBinary, nil
	}
	mediaType, mediaTypeParams, err := mime.ParseMediaType(v)
	if err != nil {
		return 0, err
	}
	return FormatFromMediaType(mediaType, mediaTypeParams)
}
268950
func (r *Request) ExpectContentType(contentType string) *Request {
	r.fallbackContentType = contentType
	return r
}
292483
func (h *HugoSites) GetContentPage(filename string) page.Page {
	for _, s := range h.Sites {
		pos := s.rawAllPages.findPagePosByFilename(filename)
		if pos == -1 {
			continue
		}
		return s.rawAllPages[pos]
	}

	// If not found already, this may be bundled in another content file.
	dir := filepath.Dir(filename)

	for _, s := range h.Sites {
		pos := s.rawAllPages.findPagePosByFilnamePrefix(dir)
		if pos == -1 {
			continue
		}
		return s.rawAllPages[pos]
	}
	return nil
}
418282
func (s *SynthesizeSpeechOutput) SetContentType(v string) *SynthesizeSpeechOutput {
	s.ContentType = &v
	return s
}
311687
func (p *Packet) GetUDPType() byte {
	// Every UDP control packet has a 20 byte packet signature. The
	// first 2 bytes represent the following control information.
	// Byte 0 : Bits 0,1 are reserved fields.
	//          Bits 2,3,4 represent version information.
	//          Bits 5,6 represent udp packet type,
	//          Bit 7 represents encryption. (currently unused).
	// Byte 1: reserved for future use.
	// Bytes [2:20]: Packet signature.
	return GetUDPTypeFromBuffer(p.ipHdr.Buffer[p.ipHdr.ipHeaderLen:])
}