]> gitweb.factorcode.org Git - factor.git/commitdiff
http.client: Added OPTIONS, TRACE and HEAD HTTP methods
authorotoburb <otoburb@gmail.com>
Wed, 11 May 2011 21:45:26 +0000 (21:45 +0000)
committerotoburb <otoburb@gmail.com>
Thu, 12 May 2011 01:32:00 +0000 (01:32 +0000)
basis/http/client/client-tests.factor
basis/http/client/client.factor

index 7a7fcffc741d5a838971d0a9a4e4018a8cbf0209..515189fbe38929cc76b695805373bf575c65c16e 100644 (file)
@@ -1,4 +1,4 @@
-USING: http.client http.client.private http tools.test
+USING: accessors http.client http.client.private http tools.test
 namespaces urls ;
 IN: http.client.tests
 
@@ -37,3 +37,9 @@ IN: http.client.tests
     "https://www.amazon.com/index.html"
     <get-request>
 ] unit-test
+
+[ "HEAD" ] [ "http://google.com" <head-request> method>> ] unit-test
+[ "DELETE" ] [ "http://arc.com" <delete-request> method>> ] unit-test
+[ "TRACE" ] [ "http://concatenative.org" <trace-request> method>> ] unit-test
+[ "OPTIONS" ] [ "http://factorcode.org" <options-request> method>> ] unit-test
+
index 69e84001beb1a5a429dcc623167046d397be4e3a..4925f571012881d501db9e2bba89728e1e103281 100644 (file)
@@ -202,6 +202,24 @@ ERROR: download-failed response ;
 : http-delete ( url -- response data )
     <delete-request> http-request ;
 
+: <head-request> ( url -- request )
+    "HEAD" <client-request> ;
+
+: http-head ( url -- response data )
+    <head-request> http-request ;
+
+: <options-request> ( url -- request )
+    "OPTIONS" <client-request> ;
+
+: http-options ( url -- response data )
+    <options-request> http-request ;
+
+: <trace-request> ( url -- request )
+    "TRACE" <client-request> ;
+
+: http-trace ( url -- response data )
+    <trace-request> http-request ;
+
 USE: vocabs.loader
 
 { "http.client" "debugger" } "http.client.debugger" require-when