Skip to content

Conversation

@seowalex
Copy link
Contributor

@seowalex seowalex commented Dec 11, 2025

In #943 (comment), sending sync requests in async contexts was accidentally broken. As #957 and #958 correctly point out, this is because the future's result was not awaited.

Instead of creating a separate event loop as #957 and #958 do, I have opted to properly separate the sync and async HTTPX handlers, as the only reason async functions were being run in a sync context was to reuse the functions.

To do this, I have pushed the logic to convert the byte stream (which is the only truly async function) up into the respective sync/async handlers, which allows the other functions to be sync (and thus callable from the respective handlers without additional work).

I have also added a test for this regression and removed the extraneous pytest.mark.online markers.

@seowalex
Copy link
Contributor Author

Tagging @jairhenrique given you reviewed my previous PR, I think this is a fairly important bugfix.

@seowalex seowalex force-pushed the master branch 2 times, most recently from 728bc26 to 1ef0356 Compare December 11, 2025 05:30
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.32%. Comparing base (2c4df79) to head (1ef0356).
⚠️ Report is 22 commits behind head on master.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #965      +/-   ##
==========================================
+ Coverage   92.23%   92.32%   +0.08%     
==========================================
  Files          27       27              
  Lines        1868     1863       -5     
  Branches      249      248       -1     
==========================================
- Hits         1723     1720       -3     
+ Misses         97       94       -3     
- Partials       48       49       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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