summaryrefslogtreecommitdiff
path: root/tests/it_url.t
diff options
context:
space:
mode:
authorNathan Gass2012-10-15 17:58:13 +0000
committerNathan Gass2012-10-15 17:58:13 +0000
commit35dbf89715a56fe976b0bb5714b00e7b94748895 (patch)
tree12cb82b067fc7ec67bb7ca5c2b2718cc41cffcb6 /tests/it_url.t
parent6cca63fafdfa80bcc1e56e1e91b1b2492b34e018 (diff)
downloaditools-35dbf89715a56fe976b0bb5714b00e7b94748895.tar.gz
itools-35dbf89715a56fe976b0bb5714b00e7b94748895.tar.bz2
itools-35dbf89715a56fe976b0bb5714b00e7b94748895.zip
test basic request headers
Diffstat (limited to 'tests/it_url.t')
-rwxr-xr-xtests/it_url.t26
1 files changed, 26 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