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 ;
[ "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