An OCaml library for building HTTP clients and servers with support for multiple asynchronous backends including Lwt, Async, and Eio.
ocaml-cohttp is a comprehensive OCaml library for creating HTTP clients and servers. It provides a portable, dependency-free HTTP parser and supports multiple asynchronous backends like Lwt, Async, Eio, and Js_of_ocaml, enabling deployment across diverse targets from UNIX systems to MirageOS unikernels and JavaScript compilation.
OCaml developers building HTTP-based applications, including those targeting web services, MirageOS unikernels, or JavaScript environments via Js_of_ocaml. It's suitable for projects requiring flexible concurrency models and cross-platform compatibility.
Developers choose ocaml-cohttp for its portability, minimal dependencies, and support for multiple asynchronous libraries, allowing them to select the best backend for their specific use case while maintaining a consistent HTTP interface. Its extensible architecture and included utility binaries for testing further streamline development.
An OCaml library for HTTP clients and servers using Lwt or Async
The parser is fast and dependency-free, enabling easy interoperability with other OCaml packages and simplifying integration.
Supports Lwt, Async, Eio, and Js_of_ocaml, allowing developers to choose the concurrency model best suited for their platform, from UNIX to JavaScript.
Works on UNIX systems, MirageOS unikernels, and compiles to JavaScript via Js_of_ocaml, making it versatile for diverse target environments.
The IO signature enables easy implementation of custom backends, as demonstrated in the Docker socket client example for specialized resolvers.
Multipart form data and session management are not built-in, requiring integration with external libraries like multipart_form or ocaml-session, increasing setup complexity.
HTTP redirects are not automatically managed; developers must implement custom logic, as admitted in the README with tutorial examples for both Lwt and Async backends.
With multiple async backends available, selecting and configuring the right one can be daunting, especially for newcomers to OCaml's concurrency ecosystem.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.