// checkContentType verifies the HTTP Content-Type header properly
// declares the document is XML and UTF-8. Blank is assumed OK.
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
}
1140993
func (s *InvokeEndpointInput) SetContentType(v string) *InvokeEndpointInput {
	s.ContentType = &v
	return s
}
1006672
func (h *HTTPBodyMarshaler) ContentTypeFromMessage(v interface{}) string {
	if httpBody, ok := v.(*httpbody.HttpBody); ok {
		return httpBody.GetContentType()
	}
	return h.Marshaler.ContentType()
}
3250
func (s *Model) SetContentType(v string) *Model {
	s.ContentType = &v
	return s
}
48061
func (s *DescribeObjectOutput) SetContentType(v string) *DescribeObjectOutput {
	s.ContentType = &v
	return s
}
1081066
func (s *PostContentInput) SetContentType(v string) *PostContentInput {
	s.ContentType = &v
	return s
}
391314
func (s *Message) SetContentType(v string) *Message {
	s.ContentType = &v
	return s
}
891076
func ContentType(ctypes ...string) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		if contentMethod(r.Method) && !checkCT(r.Header.Get("Content-Type"), ctypes...) {
			w.WriteHeader(http.StatusUnsupportedMediaType)
		}
	}
}
351869
func (s *InitiateDocumentVersionUploadInput) SetContentType(v string) *InitiateDocumentVersionUploadInput {
	s.ContentType = &v
	return s
}
339022
func WithContentType(handler http.Handler, contentType string) http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		w.Header().Set("Content-Type", contentType)
		w.Header().Set("X-Content-Type-Options", "nosniff")
		handler.ServeHTTP(w, r)
	})
}
1241382
func DetectContentType(body interface{}) string {
	contentType := plainTextType
	kind := kindOf(body)
	switch kind {
	case reflect.Struct, reflect.Map:
		contentType = jsonContentType
	case reflect.String:
		contentType = plainTextType
	default:
		if b, ok := body.([]byte); ok {
			contentType = http.DetectContentType(b)
		} else if kind == reflect.Slice {
			contentType = jsonContentType
		}
	}

	return contentType
}
939540
func (si SignerInfo) GetContentTypeAttribute() (asn1.ObjectIdentifier, error) {
	rv, err := si.SignedAttrs.GetOnlyAttributeValueBytes(oid.AttributeContentType)
	if err != nil {
		return nil, err
	}

	var ct asn1.ObjectIdentifier
	if rest, err := asn1.Unmarshal(rv.FullBytes, &ct); err != nil {
		return nil, err
	} else if len(rest) > 0 {
		return nil, ErrTrailingData
	}

	return ct, nil
}
215393
func (s *GetExportOutput) SetContentType(v string) *GetExportOutput {
	s.ContentType = &v
	return s
}
231985
func getContentType(val string) string {
	args := strings.SplitN(val, ";", 2)
	if len(args) > 0 {
		return strings.TrimSpace(args[0])
	}
	return val
}
1209053
func (s *GetObjectOutput) SetContentType(v string) *GetObjectOutput {
	s.ContentType = &v
	return s
}
926694
func InvalidContentType(value string, allowed []string) *Validation {
	values := make([]interface{}, 0, len(allowed))
	for _, v := range allowed {
		values = append(values, v)
	}
	return &Validation{
		code:    http.StatusUnsupportedMediaType,
		Name:    "Content-Type",
		In:      "header",
		Value:   value,
		Values:  values,
		message: fmt.Sprintf(contentTypeFail, value, allowed),
	}
}
819513
func (s *UpdateUploadInput) SetContentType(v string) *UpdateUploadInput {
	s.ContentType = &v
	return s
}