]> gitweb.factorcode.org Git - factor.git/commitdiff
download word throneeds to ws an error if the request did not return a success code...
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Thu, 9 Apr 2009 13:18:26 +0000 (08:18 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Thu, 9 Apr 2009 13:18:26 +0000 (08:18 -0500)
basis/http/client/client.factor
basis/http/http-tests.factor

index 805929d27b0a109f9726611da4261ac11a79b64a..307fdd50314749880eed2d21aca99c3ac76433ea 100644 (file)
@@ -165,7 +165,7 @@ ERROR: download-failed response ;
     present file-name "?" split1 drop "/" ?tail drop ;
 
 : download-to ( url file -- )
-    binary [ [ write ] with-http-get drop ] with-file-writer ;
+    binary [ [ write ] with-http-get check-response drop ] with-file-writer ;
 
 : download ( url -- )
     dup download-name download-to ;
index da50a6f85f3a63a6dd2c656b04c6138c269d5e8b..45ad132677b8c031d74f525226de186fd632b05b 100644 (file)
@@ -392,4 +392,7 @@ SYMBOL: a
 
 [ "OK" ] [ "data" "http://localhost/a" add-port http-post nip ] unit-test
 
-[ ] [ "http://localhost/quit" add-port http-get 2drop ] unit-test
\ No newline at end of file
+! Check that download throws errors (reported by Chris Double)
+[ "http://localhost/tweet_my_twat" add-port download ] must-fail
+
+[ ] [ "http://localhost/quit" add-port http-get 2drop ] unit-test