package curly

  1. Overview
  2. Docs
The Dumbest Http Client

Install

Dune Dependency

Authors

Maintainers

Sources

0.1.0.zip
md5=a9db9c3d8dcc887eea3c1913cfe44461

Description

Curly is a brain dead wrapper around the curl command line utility designed to provide a 0 dependency solution for applications that want to create some very simple HTTP requests. It is not blazing fast, or async, but at least it involves no C bindings, it's trivial to vendor, and the API can be learned in 5 minutes.

Here's a simple example:


match Curly.(run (Request.make ~url:"https://opam.ocaml.org" ~meth:`GET ())) with
| Ok x ->
  Format.printf "status: %d\n" x.Curly.Response.code;
  Format.printf "headers: %a\n" Curly.Header.pp x.Curly.Response.headers;
  Format.printf "body: %s\n" x.Curly.Response.body
| Error e ->
  Format.printf "Failed: %a" Curly.Error.pp e

There's not much more to it than this. Consult curly.mli to see how to construct various requests and read responses.

Published: 09 Aug 2017

README

Curly - The Dumbest Http Client

Curly is a brain dead wrapper around the curl command line utility designed to provide a 0 dependency solution for applications that want to create some very simple HTTP requests. It is not blazing fast, or async, but at least it involves no C bindings, it's trivial to vendor, and the API can be learned in 5 minutes.

Here's a simple example:


match Curly.(run (Request.make ~url:"https://opam.ocaml.org" ~meth:`GET ())) with
| Ok x ->
  Format.printf "status: %d\n" x.Curly.Response.code;
  Format.printf "headers: %a\n" Curly.Header.pp x.Curly.Response.headers;
  Format.printf "body: %s\n" x.Curly.Response.body
| Error e ->
  Format.printf "Failed: %a" Curly.Error.pp e

There's not much more to it than this. Consult curly.mli to see how to construct various requests and read responses.

Dependencies (4)

  1. result
  2. base-unix
  3. jbuilder >= "1.0+beta9"
  4. ocaml >= "4.02.3"

Dev Dependencies (3)

  1. lwt with-test & < "4.0.0"
  2. alcotest with-test
  3. cohttp-lwt-unix with-test & != "3.0.0"

Used by (2)

  1. calculon-web >= "0.5"
  2. dune-release >= "1.4.0" & < "2.0.0"

Conflicts

None