diff options
author | Nathan Gass | 2023-10-30 16:53:51 +0100 |
---|---|---|
committer | Nathan Gass | 2023-10-30 16:53:51 +0100 |
commit | f90ee95af7bcc5cc4a9734bacfdd7e99b88b4b09 (patch) | |
tree | fd67874aa376e9fd79307a96645085a8f9eb85b1 | |
parent | f471ee2b21d1dd24945ead7f38a3254585408991 (diff) | |
download | itools-f90ee95af7bcc5cc4a9734bacfdd7e99b88b4b09.tar.gz itools-f90ee95af7bcc5cc4a9734bacfdd7e99b88b4b09.tar.bz2 itools-f90ee95af7bcc5cc4a9734bacfdd7e99b88b4b09.zip |
add test that maxlength aborts early
-rwxr-xr-x | test/it_url_slow.t | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/it_url_slow.t b/test/it_url_slow.t index 51da6b9..1f43edc 100755 --- a/test/it_url_slow.t +++ b/test/it_url_slow.t @@ -51,6 +51,20 @@ $output = server_output(); if (!$res || !$res2) diag($output); +$start = microtime(true); +$res = ok( + !it_url::get(['url' => 'http://localhost:8000/slow_response', 'maxlength' => 10, 'retries' => 0, 'it_error' => false]), + 'it_url::get() fails for response larger than maxlength' +); +$res2 = is( + intval(microtime(true) - $start), 1, + '... and fails as soon as maxlength is surpassed' +); +sleep(1); # wait for testserver +$output = server_output(); +if (!$res || !$res2) + diag($output); + handle_server( ok( it_url::get(U('http://localhost:8000/repeat', ['string' => "abc", 'num' => 1024 * 1024])) == str_repeat("abc", 1024 * 1024), |