summaryrefslogtreecommitdiff
path: root/test/it_url.testserver.php
diff options
context:
space:
mode:
authorUrban Müller2020-08-04 17:55:30 +0200
committerUrban Müller2020-08-04 17:55:30 +0200
commit3538e258590fda78b697ef0e8280585f818034e4 (patch)
tree1c331b59eef8f77a5b7945321116570c082810df /test/it_url.testserver.php
parent8e92b60178c34f785d6bcdd4634345e8937605b1 (diff)
downloaditools-3538e258590fda78b697ef0e8280585f818034e4.tar.gz
itools-3538e258590fda78b697ef0e8280585f818034e4.tar.bz2
itools-3538e258590fda78b697ef0e8280585f818034e4.zip
correctly retry in ::get_multi, do retry in status 5xx in ::get
Diffstat (limited to 'test/it_url.testserver.php')
-rw-r--r--test/it_url.testserver.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/it_url.testserver.php b/test/it_url.testserver.php
index 64e6674..f895d61 100644
--- a/test/it_url.testserver.php
+++ b/test/it_url.testserver.php
@@ -1,5 +1,5 @@
<?php
-$stderr = fopen('php://stderr', 'w');
+$stderr = it::fopen('php://stderr', 'w');
fwrite($stderr, "Got Request: '" . $_SERVER['REQUEST_URI'] . "'\n");
$base = 'http://' . $_SERVER['HTTP_HOST'];
@@ -69,6 +69,12 @@ switch ($_SERVER['PHP_SELF'])
http_response_code(204);
break;
+ case "/maybe_error":
+ $iserror = rand(0, 99) <= $_REQUEST['chance'];
+ http_response_code($iserror ? 500 : 200);
+ echo $iserror ? "failure" : "success";
+ break;
+
default:
http_response_code(404);
fwrite($stderr, "Unknown path '$_SERVER[PHP_SELF]' not handled!\n");