diff --git a/rpclib-js.opam b/rpclib-js.opam index 6adfafa2..41609a2e 100644 --- a/rpclib-js.opam +++ b/rpclib-js.opam @@ -10,8 +10,8 @@ depends: [ "ocaml" "dune" {>= "1.1.0"} "rpclib" {>= "5.0.0"} - "js_of_ocaml" {>= "3.3.0"} - "js_of_ocaml-ppx" {>= "3.3.0"} + "js_of_ocaml" {>= "3.5.0"} + "js_of_ocaml-ppx" {>= "3.5.0"} "lwt" ] build: ["dune" "build" "-p" name "-j" jobs] diff --git a/src/js/rpc_client_js.ml b/src/js/rpc_client_js.ml index 8e881d27..bcff4f21 100644 --- a/src/js/rpc_client_js.ml +++ b/src/js/rpc_client_js.ml @@ -27,7 +27,11 @@ let do_rpc enc dec content_type ~url call = Js_of_ocaml.Js.wrap_callback (fun _ -> match req ##. readyState with | Js_of_ocaml.XmlHttpRequest.DONE -> - Lwt.wakeup w (dec (Js_of_ocaml.Js.to_string req ##. responseText)) + Lwt.wakeup w (dec + (Js_of_ocaml.Js.Opt.case + req##.responseText + (fun () -> "") + (fun x -> Js_of_ocaml.Js.to_string x))) | _ -> () ) ; req ## send (Js_of_ocaml.Js.some (Js_of_ocaml.Js.string contents)) ; Lwt.on_cancel res (fun () -> req ## abort) ;