Announcing http-easy

Yesterday I released http-easy, a high-level HTTP client for Racket. I started working on it after getting annoyed at some of the code in my racket-sentry package. The same day I wrote that code, someone started a mailing list thread asking for a "practical" HTTP client so that served as additional motivation to spend some time on this problem.

Here's a basic example:

(require net/http-easy)
(response-xexpr (get ""))

It might not seem like much, but even just that gets you automatic connection pooling. Want to stream response bodies instead of reading them up front? Just pass in #t for the #:stream? argument:

(define inp
   (get "" #:stream? #t)))
(read-bytes 10 inp)

Want to POST some JSON somewhere? Use the #:json keyword argument:

 #:json (hasheq 'hello "world")

Need to upload a file? It's got you covered:

 #:data (multipart-payload
         (file-part "f" (open-input-file "example-1.txt"))
         (file-part "f" (open-input-file "example-2.txt")))

You can find these examples and more in the documentation. The only big feature that's currently missing is proxy support, but I plan to add that soon. The library is pre-1.0 so, if you do start using it, keep in mind that its API might change before it stabilizes.