feat: add `ImpitHttpClient` http-client client using the `impit` library by Mantisus · Pull Request #1151 · apify/crawlee-python

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you are following established pattern about adding new test file for the new client, but maybe now is the time to refactor the tests and have only one test file for all clients and parametrize all tests with client.

For example:

@pytest.mark.parametrize("http_client", [
    CurlImpersonateHttpClient(http_version=CurlHttpVersion.V1_1),
    ImpitHttpClient(),
    HttpxHttpClient(http2=False)])
async def test_http_1(http_client: HttpClient, server_url: URL) -> None:
    response = await http_client.send_request(str(server_url))
    assert response.http_version == 'HTTP/1.1'

Maybe we would need 3xclient factories instead and parametrize by that, but regardless of that I think it would be great to reduce code duplication and ensure that we have exactly the same tests for all clients and that they can all work in exactly the same way.

But this is just a suggestion. Maybe it can be done in separate PR as well to not mix new implementation with pure refactoring.