code: def validate_request():
          
          flask_request = request
          request_data = flask_request.get_data()
  
          if not request_data:
              request_data = b'{}'
  
          request_data = request_data.decode('utf-8')
  
          try:
              json.loads(request_data)
          except ValueError as json_error:
              LOG.debug("Request body was not json. Exception: %s", str(json_error))
              return LambdaErrorResponses.invalid_request_content(
                  "Could not parse request body into json: No JSON object could be decoded")
  
          if flask_request.args:
              LOG.debug("Query parameters are in the request but not supported")
              return LambdaErrorResponses.invalid_request_content("Query Parameters are not supported")
  
          request_headers = CaseInsensitiveDict(flask_request.headers)
  
          log_type = request_headers.get('X-Amz-Log-Type', 'None')
          if log_type != 'None':
              LOG.debug("log-type: %s is not supported. None is only supported.", log_type)
              return LambdaErrorResponses.not_implemented_locally(
                  "log-type: {} is not supported. None is only supported.".format(log_type))
  
          invocation_type = request_headers.get('X-Amz-Invocation-Type', 'RequestResponse')
          if invocation_type != 'RequestResponse':
              LOG.warning("invocation-type: %s is not supported. RequestResponse is only supported.", invocation_type)
              return LambdaErrorResponses.not_implemented_locally(
                  "invocation-type: {} is not supported. RequestResponse is only supported.".format(invocation_type))
docs: Validates the incoming request
  
          The following are invalid
              1. The Request data is not json serializable
              2. Query Parameters are sent to the endpoint
              3. The Request Content-Type is not application/json
              4. 'X-Amz-Log-Type' header is not 'None'
              5. 'X-Amz-Invocation-Type' header is not 'RequestResponse'
  
          Returns
          -------
          flask.Response
              If the request is not valid a flask Response is returned
  
          None:
              If the request passes all validation