-
-
Notifications
You must be signed in to change notification settings - Fork 611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(plugins): add support for httpx
in B113
#1060
Changes from all commits
5623f06
277b04c
77d2901
4fc4f19
8e26f94
2e2e442
0ee786c
9920484
a1e7d7f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,68 @@ | ||
import httpx | ||
import requests | ||
import not_requests | ||
|
||
# Errors | ||
requests.get('https://gmail.com') | ||
requests.get('https://gmail.com', timeout=None) | ||
requests.get('https://gmail.com', timeout=5) | ||
requests.post('https://gmail.com') | ||
requests.post('https://gmail.com', timeout=None) | ||
requests.post('https://gmail.com', timeout=5) | ||
requests.put('https://gmail.com') | ||
requests.put('https://gmail.com', timeout=None) | ||
requests.put('https://gmail.com', timeout=5) | ||
requests.delete('https://gmail.com') | ||
requests.delete('https://gmail.com', timeout=None) | ||
requests.delete('https://gmail.com', timeout=5) | ||
requests.patch('https://gmail.com') | ||
requests.patch('https://gmail.com', timeout=None) | ||
requests.patch('https://gmail.com', timeout=5) | ||
requests.options('https://gmail.com') | ||
requests.options('https://gmail.com', timeout=None) | ||
requests.options('https://gmail.com', timeout=5) | ||
requests.head('https://gmail.com') | ||
requests.head('https://gmail.com', timeout=None) | ||
requests.head('https://gmail.com', timeout=5) | ||
httpx.get('https://gmail.com') | ||
httpx.get('https://gmail.com', timeout=None) | ||
httpx.post('https://gmail.com') | ||
httpx.post('https://gmail.com', timeout=None) | ||
httpx.put('https://gmail.com') | ||
httpx.put('https://gmail.com', timeout=None) | ||
httpx.delete('https://gmail.com') | ||
httpx.delete('https://gmail.com', timeout=None) | ||
httpx.patch('https://gmail.com') | ||
httpx.patch('https://gmail.com', timeout=None) | ||
httpx.options('https://gmail.com') | ||
httpx.options('https://gmail.com', timeout=None) | ||
httpx.head('https://gmail.com') | ||
httpx.head('https://gmail.com', timeout=None) | ||
httpx.Client() | ||
httpx.Client(timeout=None) | ||
httpx.AsyncClient() | ||
httpx.AsyncClient(timeout=None) | ||
with httpx.Client() as client: | ||
client.get('https://gmail.com') | ||
with httpx.Client(timeout=None) as client: | ||
client.get('https://gmail.com') | ||
async with httpx.AsyncClient() as client: | ||
await client.get('https://gmail.com') | ||
async with httpx.AsyncClient(timeout=None) as client: | ||
await client.get('https://gmail.com') | ||
|
||
# Okay | ||
not_requests.get('https://gmail.com') | ||
requests.get('https://gmail.com', timeout=5) | ||
requests.post('https://gmail.com', timeout=5) | ||
requests.put('https://gmail.com', timeout=5) | ||
requests.delete('https://gmail.com', timeout=5) | ||
requests.patch('https://gmail.com', timeout=5) | ||
requests.options('https://gmail.com', timeout=5) | ||
requests.head('https://gmail.com', timeout=5) | ||
httpx.get('https://gmail.com', timeout=5) | ||
httpx.post('https://gmail.com', timeout=5) | ||
httpx.put('https://gmail.com', timeout=5) | ||
httpx.delete('https://gmail.com', timeout=5) | ||
httpx.patch('https://gmail.com', timeout=5) | ||
httpx.options('https://gmail.com', timeout=5) | ||
httpx.head('https://gmail.com', timeout=5) | ||
httpx.Client(timeout=5) | ||
httpx.AsyncClient(timeout=5) | ||
with httpx.Client(timeout=5) as client: | ||
client.get('https://gmail.com') | ||
async with httpx.AsyncClient(timeout=5) as client: | ||
await client.get('https://gmail.com') |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import httpx | ||
import requests | ||
|
||
# Errors | ||
requests.get('https://gmail.com', timeout=30, verify=True) | ||
requests.get('https://gmail.com', timeout=30, verify=False) | ||
requests.post('https://gmail.com', timeout=30, verify=True) | ||
|
@@ -16,25 +17,26 @@ | |
requests.head('https://gmail.com', timeout=30, verify=True) | ||
requests.head('https://gmail.com', timeout=30, verify=False) | ||
|
||
httpx.request('GET', 'https://gmail.com', verify=True) | ||
httpx.request('GET', 'https://gmail.com', verify=False) | ||
httpx.get('https://gmail.com', verify=True) | ||
httpx.get('https://gmail.com', verify=False) | ||
httpx.options('https://gmail.com', verify=True) | ||
httpx.options('https://gmail.com', verify=False) | ||
httpx.head('https://gmail.com', verify=True) | ||
httpx.head('https://gmail.com', verify=False) | ||
httpx.post('https://gmail.com', verify=True) | ||
httpx.post('https://gmail.com', verify=False) | ||
httpx.put('https://gmail.com', verify=True) | ||
httpx.put('https://gmail.com', verify=False) | ||
httpx.patch('https://gmail.com', verify=True) | ||
httpx.patch('https://gmail.com', verify=False) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please just add a separate file rather than abuse this one There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding the check for missing timeouts on For the missing timeouts, I can still create a separate test case and example file if you prefer though. I wanted to stay consistent with what has been done in #861, but having a separate test case would probably be preferrable. |
||
httpx.delete('https://gmail.com', verify=True) | ||
httpx.delete('https://gmail.com', verify=False) | ||
httpx.stream('https://gmail.com', verify=True) | ||
httpx.stream('https://gmail.com', verify=False) | ||
httpx.Client() | ||
httpx.Client(verify=False) | ||
httpx.AsyncClient() | ||
httpx.AsyncClient(verify=False) | ||
# Okay | ||
httpx.request('GET', 'https://gmail.com', timeout=30, verify=True) | ||
httpx.request('GET', 'https://gmail.com', timeout=30, verify=False) | ||
httpx.get('https://gmail.com', timeout=30, verify=True) | ||
httpx.get('https://gmail.com', timeout=30, verify=False) | ||
httpx.options('https://gmail.com', timeout=30, verify=True) | ||
httpx.options('https://gmail.com', timeout=30, verify=False) | ||
httpx.head('https://gmail.com', timeout=30, verify=True) | ||
httpx.head('https://gmail.com', timeout=30, verify=False) | ||
httpx.post('https://gmail.com', timeout=30, verify=True) | ||
httpx.post('https://gmail.com', timeout=30, verify=False) | ||
httpx.put('https://gmail.com', timeout=30, verify=True) | ||
httpx.put('https://gmail.com', timeout=30, verify=False) | ||
httpx.patch('https://gmail.com', timeout=30, verify=True) | ||
httpx.patch('https://gmail.com', timeout=30, verify=False) | ||
httpx.delete('https://gmail.com', timeout=30, verify=True) | ||
httpx.delete('https://gmail.com', timeout=30, verify=False) | ||
httpx.stream('https://gmail.com', timeout=30, verify=True) | ||
httpx.stream('https://gmail.com', timeout=30, verify=False) | ||
httpx.Client(timeout=30) | ||
httpx.Client(timeout=30, verify=False) | ||
httpx.AsyncClient(timeout=30) | ||
httpx.AsyncClient(timeout=30, verify=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't remove these. They verify there's no regression when someone passes a timeout value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They have not been removed but moved under "Okay" section below, since those cases did not trigger violations.