Repository navigation
Conversation
Author
|
I am withdrawing this small test-mocking change as part of narrowing my outstanding contributions. The code remains on 00200200:codex/clone-async-side-effect-responses for reference. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An async side effect can return a response without an attached request.
Router.aresolvecurrently skips the cloning performed byRoute.resolvefor synchronous side effects. When that response is reused through HTTPX MockTransport, both requests receive the same object and the second request overwrites the first response's request metadata. Callingasync_handlerdirectly also leavesresponse.requestunset.Clone responses without an attached request immediately after awaiting the side effect, using the existing helper. Responses with an explicit request retain their current behavior. Regression tests cover both request cases and response reuse through AsyncClient/MockTransport.
Validation on macOS/Python 3.12.11 with HTTPX 0.28.1:
git diff --checkpassed.type: ignoreintests/test_router.py. The same check on the unchanged base commit reports the identical error (line 341 on the base, line 384 with these tests).Other Python versions and live remote pass-through were not tested. The full pre-commit environment was not installed.