Fix treq.request() argument handling#431
Merged
Merged
Conversation
adiroiban
approved these changes
Jul 1, 2026
adiroiban
left a comment
Member
There was a problem hiding this comment.
Looks good. Thanks!
Only very minor comments.
| _S = Union[bytes, str] | ||
|
|
||
| _URLType = Union[ | ||
| _SomeURL = Union[ |
Member
There was a problem hiding this comment.
Maybe call it _TreqURL ... some seems strange to me
Comment on lines
+111
to
+118
| for func in ( | ||
| treq.head, | ||
| treq.get, | ||
| treq.post, | ||
| treq.put, | ||
| treq.patch, | ||
| treq.delete, | ||
| ): |
Member
There was a problem hiding this comment.
Maybe also assert the HTTP method used for each function
Suggested change
| for func in ( | |
| treq.head, | |
| treq.get, | |
| treq.post, | |
| treq.put, | |
| treq.patch, | |
| treq.delete, | |
| ): | |
| for func, method in ( | |
| (treq.head, 'HEAD'), | |
| (treq.get, 'GET'), | |
| (treq.post, 'POST'), | |
| (treq.put, 'PUT'), | |
| (treq.patch, 'PATCH'), | |
| (treq.delete, 'DELETE'), | |
| ): |
| self.requests += 1 | ||
| return defer.Deferred() | ||
| self.assertNoResult(d) | ||
| self.assertEqual(1, counter_agent.requests) |
Member
There was a problem hiding this comment.
Not sure if the CounterAgent is good enough...
I was thinking to make sure that each function is associated
Suggested change
| self.assertEqual(1, counter_agent.requests) | |
| self.assertEqual([(method, "https://www.example.org/")], counter_agent.requests) |
Member
Author
There was a problem hiding this comment.
Sounds like a job for agent_spy()!
twm
commented
Jul 1, 2026
twm
left a comment
Member
Author
There was a problem hiding this comment.
Thank you for the review @adiroiban!
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.
Following up on #401, this fixes some bugs in the parameter handling of
treq.request(). This addresses that hole in the test suite.I still need to:
IndexableCookieJardocsRequestsCookieJar_HeadersType(as noted inline)I'm putting this PR up now just to be clear that we're not ready to release.