rgrinberg / opium

Sinatra like web toolkit for OCaml

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Changes in API from Cohttp version

roddyyaga opened this issue · comments

In the Cohttp version, there is a respond function and body type like this:

let to_body = function
  | `String s -> Body.of_string s
  | `Empty -> Body.empty
  | `Json j -> j |> Yojson.Safe.to_string |> Body.of_string

let respond ?headers ?status body =
  Response.make ?headers ?status ~body:(to_body body) () |> Lwt.return

Personally I thought that was a nice API, is there a reason it's been removed from the latest version?