]> gitweb.factorcode.org Git - factor.git/commitdiff
Add http-put, and make any return code between 200 and 299 success.
authorAlex Chapman <chapman.alex@gmail.com>
Wed, 17 Sep 2008 09:35:30 +0000 (19:35 +1000)
committerAlex Chapman <chapman.alex@gmail.com>
Wed, 17 Sep 2008 09:35:30 +0000 (19:35 +1000)
basis/http/client/client.factor

index 8dc1924a12163d3c2650cc40e340d961b66aec5f..46bee405d16e2e9570b0cfcaa2276d59c3d05a6a 100755 (executable)
@@ -141,7 +141,7 @@ PRIVATE>
         do-redirect
     ] with-variable ;
 
-: success? ( code -- ? ) 200 = ;
+: success? ( code -- ? ) 200 299 between? ;
 
 ERROR: download-failed response body ;
 
@@ -183,3 +183,9 @@ M: download-failed error.
 
 : http-post ( post-data url -- response data )
     <post-request> http-request ;
+
+: <put-request> ( data url -- request )
+    <post-request> "PUT" >>method ;
+
+: http-put ( data url -- response data )
+    <put-request> http-request ;