This commit is contained in:
parent
5128d72865
commit
60f65523d1
1 changed files with 5 additions and 5 deletions
|
|
@ -110,20 +110,20 @@ let keys_get req server _env =
|
|||
let* () = add ~field:"content-type" "application/json" in
|
||||
respond `OK
|
||||
|
||||
type foo = { key: string }
|
||||
type foo = { v: string }
|
||||
|
||||
let foo_jsont =
|
||||
let open Jsont in
|
||||
let enc foo = foo.key in
|
||||
let make key = { key } in
|
||||
Object.map ~kind:"foo" make |> Object.mem "key" string ~enc |> Object.finish
|
||||
let enc foo = foo.v in
|
||||
let make v = { v } in
|
||||
Object.map ~kind:"foo" make |> Object.mem "v" string ~enc |> Object.finish
|
||||
|
||||
let keys_post req _server _env =
|
||||
let open Vif.Response in
|
||||
let open Syntax in
|
||||
match Vif.Request.of_json req with
|
||||
| Ok (foo : foo) ->
|
||||
let str = Fmt.str "key: %s@." foo.key in
|
||||
let str = Fmt.str "key: %s@." foo.v in
|
||||
let* () =
|
||||
Vif.Response.add ~field:"content-type" "text/plain; charset=utf-8"
|
||||
in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue