[racket-dev] net/http-client
On Mon, Aug 26, 2013 at 6:46 AM, Sam Tobin-Hochstadt
<samth at cs.indiana.edu> wrote:
>
> On Fri, Aug 23, 2013 at 2:48 PM, Jay McCarthy <jay.mccarthy at gmail.com>
> wrote:
>>
>> I feel that the only thing it could do better is support two more
>> options for #:data:
>> - A input-port? to read from and copy to the HTTP connection
>> - A (-> output-port? void) function to call with the HTTP connection's
>> output port to stream the data
>>
>> But I'd like a second opinion before adding them.
>
> Those both sound great, but why force the second one return `void?` For
> example, I might want to stream the data directly into a JSON parser.
The function would be given to the client so it can write the data to
the server. For example:
(... #:data #"Here's the post data")
would be the same as
(... #:data (\ (op) (display #"Here's the post data" op)))
It's the HTTP connection's OUTPUT (to the server) port, not its INPUT
(from the server) port.
The return happens internally to the http-client and it doesn't have
any reason to use any value produced.
Jay
--
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay
"The glory of God is Intelligence" - D&C 93