@@ -383,40 +383,6 @@ def validate_extra_fields(
383383 return 'Unknown parameters in the request.'
384384
385385
386- @wrapt .decorator
387- def validate_request_body_type (
388- wrapped : Callable [..., str ],
389- instance : Any , # pylint: disable=unused-argument
390- args : Tuple [_RequestObjectProxy , _Context ],
391- kwargs : Dict ,
392- ) -> str :
393- """
394- Validate the request body type.
395-
396- Args:
397- wrapped: An endpoint function for `requests_mock`.
398- instance: The class that the endpoint function is in.
399- args: The arguments given to the endpoint function.
400- kwargs: The keyword arguments given to the endpoint function.
401-
402- Returns:
403- The result of calling the endpoint.
404- An `UNSUPPORTED_MEDIA_TYPE` response if the request body is valid UTF-8
405- encoded text.
406- """
407- request , context = args
408-
409- try :
410- request .body .decode ('utf-8' )
411- except UnicodeDecodeError :
412- return wrapped (* args , ** kwargs )
413-
414- text = ''
415- context .status_code = codes .UNSUPPORTED_MEDIA_TYPE
416- context .headers .pop ('Content-Type' )
417- return text
418-
419-
420386def route (
421387 path_pattern : str ,
422388 http_methods : List [str ],
@@ -453,7 +419,6 @@ def decorator(method: Callable[..., str]) -> Callable[..., str]:
453419 validate_authorization ,
454420 validate_date ,
455421 validate_date_header_given ,
456- validate_request_body_type ,
457422 validate_include_target_data ,
458423 validate_max_num_results ,
459424 validate_image_field_given ,
0 commit comments