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