]> gitweb.factorcode.org Git - factor.git/blob - basis/http/client/client-tests.factor
Fix permission bits
[factor.git] / basis / http / client / client-tests.factor
1 USING: http.client http.client.private http tools.test
2 namespaces urls ;
3
4 \ download must-infer
5
6 [ "localhost" f ] [ "localhost" parse-host ] unit-test
7 [ "localhost" 8888 ] [ "localhost:8888" parse-host ] unit-test
8
9 [ "foo.txt" ] [ "http://www.paulgraham.com/foo.txt" download-name ] unit-test
10 [ "foo.txt" ] [ "http://www.arc.com/foo.txt?xxx" download-name ] unit-test
11 [ "foo.txt" ] [ "http://www.arc.com/foo.txt/" download-name ] unit-test
12 [ "www.arc.com" ] [ "http://www.arc.com////" download-name ] unit-test
13
14 [
15     T{ request
16         { url T{ url { protocol "http" } { host "www.apple.com" } { port 80 } { path "/index.html" } } }
17         { method "GET" }
18         { version "1.1" }
19         { cookies V{ } }
20         { header H{ { "connection" "close" } { "user-agent" "Factor http.client" } } }
21     }
22 ] [
23     "http://www.apple.com/index.html"
24     <get-request>
25 ] unit-test
26
27 [
28     T{ request
29         { url T{ url { protocol "https" } { host "www.amazon.com" } { port 443 } { path "/index.html" } } }
30         { method "GET" }
31         { version "1.1" }
32         { cookies V{ } }
33         { header H{ { "connection" "close" } { "user-agent" "Factor http.client" } } }
34     }
35 ] [
36     "https://www.amazon.com/index.html"
37     <get-request>
38 ] unit-test