package cohttp-async

  1. Overview
  2. Docs
val create : (body:Body.t -> 'addr -> Http.Request.t -> response Async_kernel.Deferred.t) -> 'addr -> Async_unix.Reader.t -> Async_unix.Writer.t -> unit Async_kernel.Deferred.t

create accepts a user provided cohttp handler, and creates a server callback that works with user provided socket address, Async_unix.Reader.t and Async_unix.Writer.t. This can be useful if there is a need for more control over how the Reader and Writer get created.

val create_with_response_action : (body:Body.t -> 'addr -> Http.Request.t -> response_action Async_kernel.Deferred.t) -> 'addr -> Async_unix.Reader.t -> Async_unix.Writer.t -> unit Async_kernel.Deferred.t

create_with_response_action is similar to create but the user provided handler can use Cohttp_async.Server.response_action, and has access to using the Expert mode response that can access the underlying reader/writer pair from within the http handler.

OCaml

Innovation. Community. Security.