def METHOD_NAME(restart_api_module, get_api_details, method, endpoint_url, json_body, use_login_token,
                                 expected_status_code, expected_response_text):
    '''
    description: Check if the response_postprocessing API middleware works.
    wazuh_min_version: 4.0.0
    tier: 0
    parameters:
        - get_api_details:
            type: fixture
            brief: Get API information.
        - method:
            type: str
            brief: Method used in the API request.
        - endpoint_url:
            type: str
            brief: Endpoint requested in the test.
        - json_body:
            type: dict
            brief: JSON body used in POST API requests.
        - use_login_token:
            type: bool
            brief: Variable used to determine whether a login token for the API request is needed or not.
        - expected_status_code:
            type: int
            brief: Status code expected in the API response.
        - expected_response_text:
            type: dict
            brief: Dictionary representing the expected API response text.
    assertions:
        - Verify that the fields are the expected ones when getting a 400 status code response (bad request).
        - Verify that the fields are the expected ones when getting a 404 status code response (not found).
        - Verify that the details are the expected ones when getting a 401 status code response (unauthorized).
        - Verify that the details are the expected ones when getting a 401 status code response (invalid credentials).
    tags:
        - headers
        - security
    '''
    api_details = get_api_details()
    headers = api_details['auth_headers'] if use_login_token else api.get_login_headers('wrong_user', 'wrong_password')
    # Make an API request
    response = getattr(requests, method.lower())(f"{api_details['base_url']}{endpoint_url}", headers=headers,
                                                 verify=False, json=json_body)
    assert response.headers['Content-Type'] == 'application/problem+json; charset=utf-8'
    assert response.status_code == expected_status_code
    assert json.loads(response.text) == expected_response_text  # type and status keys deleted