diff options
author | Nathan Gass | 2012-10-15 17:58:13 +0000 |
---|---|---|
committer | Nathan Gass | 2012-10-15 17:58:13 +0000 |
commit | 35dbf89715a56fe976b0bb5714b00e7b94748895 (patch) | |
tree | 12cb82b067fc7ec67bb7ca5c2b2718cc41cffcb6 /tests | |
parent | 6cca63fafdfa80bcc1e56e1e91b1b2492b34e018 (diff) | |
download | itools-35dbf89715a56fe976b0bb5714b00e7b94748895.tar.gz itools-35dbf89715a56fe976b0bb5714b00e7b94748895.tar.bz2 itools-35dbf89715a56fe976b0bb5714b00e7b94748895.zip |
test basic request headers
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/it_url.t | 26 | ||||
-rw-r--r-- | tests/it_url.testserver.php | 4 |
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/it_url.t b/tests/it_url.t index 9b9020c..de1cd0b 100755 --- a/tests/it_url.t +++ b/tests/it_url.t @@ -206,6 +206,32 @@ $res2 = ok( if (!$res || !$res2) diag($output); +$res = is( + it_url::get(U('http://localhost:8000/get_server_value', 'key' => 'HTTP_HOST')), + 'localhost:8000', + 'TODO it_url::get() sets correct Host header', +); +$output = server_output(); +if (!$res) + diag($output); + +$res = is( + it_url::get(U('http://localhost:8000/get_server_value', 'key' => 'HTTP_ACCEPT_LANGUAGE')), + T_lang(), + 'it_url::get() sets correct Accept-Language header', +); +$output = server_output(); +if (!$res) + diag($output); + +$res = ok( + it::match('Mozilla', it_url::get(U('http://localhost:8000/get_server_value', 'key' => 'HTTP_USER_AGENT'))), + 'it_url::get() sets User-Agent containing Mozilla', +); +$output = server_output(); +if (!$res) + diag($output); + $pages = it_url::get_multi('urls' => array('a' => 'http://www.gna.ch/', 'b' => 'http://search.ch/')); ok(strpos($pages['a'], '</html>'), 'it_url::get_multi got first url'); # UTF8SAFE ok(strpos($pages['b'], '</html>'), 'it_url::get_multi got second url'); # UTF8SAFE diff --git a/tests/it_url.testserver.php b/tests/it_url.testserver.php index 22dc14b..fe90fcb 100644 --- a/tests/it_url.testserver.php +++ b/tests/it_url.testserver.php @@ -51,6 +51,10 @@ switch ($_SERVER['PHP_SELF']) } break; + case "/get_server_value": + echo $_SERVER[$_REQUEST['key']]; + break; + default: fwrite($stderr, "Unknown path '$_SERVER[PHP_SELF]' not handled!\n"); } |