def requires_json_api_mimetype(func):
 @wraps(func)
 def new_func(*args, **kw):
  'Executes ``func(*args, **kw)`` only after checking for the\n        correct JSON API :http:header:`Content-Type` header.\n\n        '
  if (request.method not in ('PATCH', 'POST')):
   return func(*args, **kw)
  header = request.headers.get('Content-Type')
  (content_type, extra) = parse_options_header(header)
  content_is_json = content_type.startswith(JSONAPI_MIMETYPE)
  is_msie = _is_msie8or9()
  if ((not is_msie) and (not content_is_json)):
   detail = 'Request must have "Content-Type: {0}" header'.format(JSONAPI_MIMETYPE)
   return error_response(415, detail=detail)
  if extra:
   detail = 'Content-Type header must not have any media type parameters but found {0}'.format(extra)
   return error_response(415, detail=detail)
  return func(*args, **kw)
 return new_func

def requires_json_api_mimetype ( func ) : @ wraps ( func ) def new_func ( * args , ** kw ) : if ( request . method not in ( 'PATCH' , 'POST' ) ) : return func ( * args , ** kw ) header = request . headers . get ( 'Content-Type' ) ( content_type , extra ) = parse_options_header ( header ) content_is_json = content_type . startswith ( JSONAPI_MIMETYPE ) is_msie = _is_msie8or9 ( ) if ( ( not is_msie ) and ( not content_is_json ) ) : detail = 'Request must have "Content-Type: {0}" header' . format ( JSONAPI_MIMETYPE ) return error_response ( 415 , detail = detail ) if extra : detail = 'Content-Type header must not have any media type parameters but found {0}' . format ( extra ) return error_response ( 415 , detail = detail ) return func ( * args , ** kw ) return new_func
decorator that requires requests *that include data* have the :http:header:content-type header required by the json api specification .