]> gitweb.factorcode.org Git - factor.git/commitdiff
http.client: add starred versions that do not check response code for success.
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 13 Mar 2014 19:26:35 +0000 (12:26 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 13 Mar 2014 19:26:35 +0000 (12:26 -0700)
basis/http/client/client-docs.factor
basis/http/client/client.factor

index 5a622a21abb5aea2a44a2569fd1ca7f7ea616c35..3c908ee61936b44e1b1d73d4afae7168f0bc5ee1 100644 (file)
@@ -55,36 +55,78 @@ HELP: http-get
 { $description "Downloads the contents of a URL." }
 { $errors "Throws an error if the HTTP request fails." } ;
 
+HELP: http-get*
+{ $values { "url" "a " { $link url } " or " { $link string } } { "response" response } { "data" sequence } }
+{ $description "Downloads the contents of a URL, but does not check the HTTP response code for success." } ;
+
+{ http-get http-get* } related-words
+
 HELP: http-post
 { $values { "post-data" object } { "url" "a " { $link url } " or " { $link string } } { "response" response } { "data" sequence } }
 { $description "Submits an HTTP POST request." }
 { $errors "Throws an error if the HTTP request fails." } ;
 
+HELP: http-post*
+{ $values { "post-data" object } { "url" "a " { $link url } " or " { $link string } } { "response" response } { "data" sequence } }
+{ $description "Submits an HTTP POST request, but does not check the HTTP response code for success." } ;
+
+{ http-post http-post* } related-words
+
 HELP: http-put
 { $values { "post-data" object } { "url" "a " { $link url } " or " { $link string } } { "response" response } { "data" sequence } }
 { $description "Submits an HTTP PUT request." }
 { $errors "Throws an error if the HTTP request fails." } ;
 
+HELP: http-put*
+{ $values { "post-data" object } { "url" "a " { $link url } " or " { $link string } } { "response" response } { "data" sequence } }
+{ $description "Submits an HTTP PUT request, but does not check the HTTP response code for success." } ;
+
+{ http-put http-put* } related-words
+
 HELP: http-head
 { $values { "url" "a " { $link url } " or " { $link string } } { "response" response } { "data" sequence } }
 { $description "Same as " { $link http-get } " except that the server is not supposed to return a message-body in the response, as per RFC2616. However in practise, most web servers respond to GET and HEAD method calls with identical responses." }
 { $errors "Throws an error if the HTTP request fails." } ;
 
+HELP: http-head*
+{ $values { "url" "a " { $link url } " or " { $link string } } { "response" response } { "data" sequence } }
+{ $description "Same as " { $link http-get* } " except that the server is not supposed to return a message-body in the response, as per RFC2616. However in practise, most web servers respond to GET and HEAD method calls with identical responses." } ;
+
+{ http-head http-head* } related-words
+
 HELP: http-delete
 { $values { "url" "a " { $link url } " or " { $link string } } { "response" response } { "data" sequence } }
 { $description "Requests that the origin server delete the resource identified by the URL." }
 { $errors "Throws an error if the HTTP request fails." } ;
 
+HELP: http-delete*
+{ $values { "url" "a " { $link url } " or " { $link string } } { "response" response } { "data" sequence } }
+{ $description "Requests that the origin server delete the resource identified by the URL, but does not check the HTTP response code for success." } ;
+
+{ http-delete http-delete* } related-words
+
 HELP: http-options
 { $values { "url" "a " { $link url } " or " { $link string } } { "response" response } { "data" sequence } }
 { $description "Submits an HTTP OPTIONS request." }
 { $errors "Throws an error if the HTTP request fails." } ;
 
+HELP: http-options*
+{ $values { "url" "a " { $link url } " or " { $link string } } { "response" response } { "data" sequence } }
+{ $description "Submits an HTTP OPTIONS request, but does not check the HTTP response code for success." } ;
+
+{ http-options http-options* } related-words
+
 HELP: http-trace
 { $values { "url" "a " { $link url } " or " { $link string } } { "response" response } { "data" sequence } }
 { $description "Submits an HTTP TRACE request." }
 { $errors "Throws an error if the HTTP request fails." } ;
 
+HELP: http-trace*
+{ $values { "url" "a " { $link url } " or " { $link string } } { "response" response } { "data" sequence } }
+{ $description "Submits an HTTP TRACE request, but does not check the HTTP response code for success." } ;
+
+{ http-trace http-trace* } related-words
+
 HELP: http-request
 { $values { "request" request } { "response" response } { "data" sequence } }
 { $description "A variant of " { $link http-request* } " that checks that the response was successful." }
@@ -108,6 +150,7 @@ ARTICLE: "http.client.get" "GET requests with the HTTP client"
 "Basic usage involves passing a " { $link url } " and getting a " { $link response } " and data back:"
 { $subsections
     http-get
+    http-get*
 }
 "Utilities to retrieve a " { $link url } " and save the contents to a file:"
 { $subsections
@@ -146,21 +189,21 @@ ARTICLE: "http.client.post-data" "HTTP client post data"
 
 ARTICLE: "http.client.post" "POST requests with the HTTP client"
 "Basic usage involves passing post data and a " { $link url } ", and getting a " { $link response } " and data back:"
-{ $subsections http-post }
+{ $subsections http-post http-post* }
 "Advanced usage involves constructing a " { $link request } ", which allows " { $link "http.cookies" } " and " { $link "http.headers" } " to be set:"
 { $subsections <post-request> }
 "Both words take a post data parameter; see " { $link "http.client.post-data" } "." ;
 
 ARTICLE: "http.client.put" "PUT requests with the HTTP client"
 "Basic usage involves passing post data and a " { $link url } ", and getting a " { $link response } " and data back:"
-{ $subsections http-put }
+{ $subsections http-put http-put* }
 "Advanced usage involves constructing a " { $link request } ", which allows " { $link "http.cookies" } " and " { $link "http.headers" } " to be set:"
 { $subsections <put-request> }
 "Both words take a post data parameter; see " { $link "http.client.post-data" } "." ;
 
 ARTICLE: "http.client.head" "HEAD requests with the HTTP client"
 "Basic usage involves passing a " { $link url } " and getting a " { $link response } " and data back:"
-{ $subsections http-head }
+{ $subsections http-head http-head* }
 "Advanced usage involves constructing a " { $link request } ", which allows " { $link "http.cookies" } " and " { $link "http.headers" } " to be set:"
 { $subsections
     <head-request>
@@ -168,7 +211,7 @@ ARTICLE: "http.client.head" "HEAD requests with the HTTP client"
 
 ARTICLE: "http.client.delete" "DELETE requests with the HTTP client"
 "Basic usage involves passing a " { $link url } " and getting a " { $link response } " and data back:"
-{ $subsections http-delete }
+{ $subsections http-delete http-delete* }
 "Advanced usage involves constructing a " { $link request } ", which allows " { $link "http.cookies" } " and " { $link "http.headers" } " to be set:"
 { $subsections
     <delete-request>
@@ -176,7 +219,7 @@ ARTICLE: "http.client.delete" "DELETE requests with the HTTP client"
 
 ARTICLE: "http.client.options" "OPTIONS requests with the HTTP client"
 "Basic usage involves passing a " { $link url } " and getting a " { $link response } " and data back:"
-{ $subsections http-options }
+{ $subsections http-options http-options* }
 "Advanced usage involves constructing a " { $link request } ", which allows " { $link "http.cookies" } " and " { $link "http.headers" } " to be set:"
 { $subsections
     <options-request>
@@ -185,7 +228,7 @@ ARTICLE: "http.client.options" "OPTIONS requests with the HTTP client"
 
 ARTICLE: "http.client.trace" "TRACE requests with the HTTP client"
 "Basic usage involves passing a " { $link url } " and getting a " { $link response } " and data back:"
-{ $subsections http-trace }
+{ $subsections http-trace http-trace* }
 "Advanced usage involves constructing a " { $link request } ", which allows " { $link "http.cookies" } " and " { $link "http.headers" } " to be set:"
 { $subsections
     <trace-request>
index 5571f2c3abf108f28494841a4ce78284be899d22..7f7d5bd3791cbbdd5c8d055880c160782cd20d7f 100644 (file)
@@ -177,6 +177,9 @@ ERROR: download-failed response ;
 : http-get ( url -- response data )
     <get-request> http-request ;
 
+: http-get* ( url -- response data )
+    <get-request> http-request* ;
+
 : download-name ( url -- name )
     present file-name "?" split1 drop "/" ?tail drop ;
 
@@ -195,6 +198,9 @@ ERROR: download-failed response ;
 : http-post ( post-data url -- response data )
     <post-request> http-request ;
 
+: http-post* ( post-data url -- response data )
+    <post-request> http-request* ;
+
 : <put-request> ( post-data url -- request )
     "PUT" <client-request>
         swap >>post-data ;
@@ -202,28 +208,43 @@ ERROR: download-failed response ;
 : http-put ( post-data url -- response data )
     <put-request> http-request ;
 
+: http-put* ( post-data url -- response data )
+    <put-request> http-request* ;
+
 : <delete-request> ( url -- request )
     "DELETE" <client-request> ;
 
 : http-delete ( url -- response data )
     <delete-request> http-request ;
 
+: 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 ;
 
+: 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 ;
 
+: 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 ;
 
+: http-trace* ( url -- response data )
+    <trace-request> http-request* ;
+
 { "http.client" "debugger" } "http.client.debugger" require-when