mirror of
https://github.com/curl/curl.git
synced 2026-07-27 22:03:05 +03:00
pytest: check 429 handling
Add a "limit" handler to httpd that responds 429 after 5 requests and then 429s all requests for 2 seconds. After which another 4 requests are served before 429 strikes again. Closes #21357
This commit is contained in:
parent
6daf4bc7e2
commit
e0b2ec2400
3 changed files with 142 additions and 3 deletions
|
|
@ -217,3 +217,15 @@ class TestErrors:
|
|||
# - CURLE_RECV_ERROR (56) - some TLS backends fail with that
|
||||
assert r.exit_code in [35, 56], \
|
||||
f'unexpected error {r.exit_code}\n{r.dump_logs()}'
|
||||
|
||||
# Get a resource many times with limited requests
|
||||
@pytest.mark.skipif(condition=not Env.have_h2_curl(), reason='curl without HTTP/2')
|
||||
def test_05_10_limits(self, env: Env, httpd):
|
||||
proto = 'h2'
|
||||
count = 6
|
||||
curl = CurlClient(env=env)
|
||||
url = f'https://{env.authority_for(env.domain1, proto)}/curltest/limit?id=[0-{count-1}]'
|
||||
r = curl.http_download(urls=[url], alpn_proto=proto, extra_args=[
|
||||
'--parallel', '--retry', '5'
|
||||
])
|
||||
r.check_stats(count=count, http_status=200, exitcode=0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue