Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tag: 1.3.0
Fetching contributors…

Cannot retrieve contributors at this time

42 lines (35 sloc) 1.177 kB
open Lwt
open Js
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
req##_open (Js.string method_, Js.string url, Js._true);
req##setRequestHeader (Js.string "Content-type", Js.string content_type);
(* List.iter (fun (n, v) -> req##setRequestHeader (Js.string n, Js.string v)) headers;*)
req##onreadystatechange <- Js.wrap_callback
(fun _ ->
(match req##readyState with
| XmlHttpRequest.DONE ->
Lwt.wakeup w (Xmlrpc.response_of_string (Js.to_string req##responseText))
(*
{XmlHttpRequest.url = url;
code = req##status;
content = Js.to_string req##responseText;
content_xml =
(fun () ->
match Js.Opt.to_option (req##responseXML) with
| None -> None
| Some doc ->
if (Js.some doc##documentElement) == Js.null
then None
else Some doc);
headers = fun _ -> None;
}
*)
| _ -> ()));
req##send (Js.some (Js.string contents));
Lwt.on_cancel res (fun () -> req##abort ()) ;
res
Jump to Line
Something went wrong with that request. Please try again.