open Opium.Std
let all_cookies = get "/cookies" begin fun req ->
let cookies = req
|> Cookie.cookies
|> List.map ~f:(fun (k,v) -> k ^ "=" ^ v)
|> String.concat "\n"
in
`String (Printf.sprintf "<pre>%s</pre>" cookies) |> respond |> return
end
let app =
App.empty
|> all_cookies
|> middleware Cookie.m
let _ =
app |> App.run_command
Testing code
Compile and run as
Testing by cUrl:
It has been changed to
��
.