Skip to content

Commit

Permalink
javascript: switch do_rpc to Rpc.call -> Rpc.response
Browse files Browse the repository at this point in the history
  • Loading branch information
David Scott committed Sep 29, 2012
1 parent bb2adaa commit 2adaa55
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions lib/rpc_client_js.ml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
open Lwt
open Js

let do_rpc url contents =
let do_rpc ~url call =
let method_ = "POST" in
let content_type = "text/xml" in
let contents = Xmlrpc.string_of_call call in
let (res, w) = Lwt.task () in
let req = XmlHttpRequest.create () in

Expand All @@ -16,7 +17,8 @@ let do_rpc url contents =
(fun _ ->
(match req##readyState with
| XmlHttpRequest.DONE ->
Lwt.wakeup w
Lwt.wakeup w (Xmlrpc.response_of_string (Js.to_string req##responseText))
(*
{XmlHttpRequest.url = url;
code = req##status;
content = Js.to_string req##responseText;
Expand All @@ -30,6 +32,7 @@ let do_rpc url contents =
else Some doc);
headers = fun _ -> None;
}
*)
| _ -> ()));

req##send (Js.some (Js.string contents));
Expand Down
2 changes: 1 addition & 1 deletion lib/rpc_client_js.mli
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
* GNU Lesser General Public License for more details.
*)

val do_rpc : string -> string -> XmlHttpRequest.http_frame Lwt.t
val do_rpc : url:string -> Rpc.call -> Rpc.response Lwt.t

0 comments on commit 2adaa55

Please sign in to comment.