Skip to content

♻️ Refactor code to support new HTTPX-based TestClient#5350

Closed
tiangolo wants to merge 1 commit intomasterfrom
fastapi-httpx-client
Closed

♻️ Refactor code to support new HTTPX-based TestClient#5350
tiangolo wants to merge 1 commit intomasterfrom
fastapi-httpx-client

Conversation

@tiangolo
Copy link
Copy Markdown
Member

@tiangolo tiangolo commented Sep 5, 2022

♻️ Refactor code to support new HTTPX-based TestClient

This was done locally using @Kludex's branch of Starlette migrating the TestClient to HTTPX.

These are the changes that will be needed in FastAPI after that is merged.

One import in applications.py will be needed either way after upgrading Starlette.

The rest of the changes all make sense and seem sensible. The code would probably make more sense after this. And although some users could need to update their test suite, their code would also look more sensible after the needed refactors.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 5, 2022

@github-actions github-actions bot temporarily deployed to pull request September 5, 2022 19:36 Inactive
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 5, 2022

@Kludex
Copy link
Copy Markdown
Member

Kludex commented Sep 9, 2022

bump-testclient makes almost all the changes you did.

What it doesn't change still:

  1. Move cookies to TestClient().
  2. Replace data as list of tuples to dictionary.

I'm working on the 2. The 1 will not be supported by the transformer. JFYK.

@tiangolo
Copy link
Copy Markdown
Member Author

This is no longer needed, it was covered in another PR 🎉 🔥

@tiangolo tiangolo closed this Nov 27, 2022
@tiangolo tiangolo deleted the fastapi-httpx-client branch November 27, 2022 13:20
vilmibm pushed a commit to internetarchive/fatcat-scholar that referenced this pull request Feb 16, 2024
seemingly, this test hits a fallback path for resolving access urls and
that fallback requires an API client; this issue may have started when
starlette (ASGI) framework switched from requests to httpx.

> So... the largest impact of this change will be for FastAPI devs.
They're the largest install base, they're using the test client, and the
change will introduce breaking changes into their test suites and
require extra work for their teams.

-- Kludex/starlette#1376 (comment)

possible mitigations: upgrade fastapi, as per notes in notes in
fastapi/fastapi#5350
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants