diff --git a/lib/js_of_ocaml/xmlHttpRequest.ml b/lib/js_of_ocaml/xmlHttpRequest.ml index dc389da6b2..d25a57930a 100644 --- a/lib/js_of_ocaml/xmlHttpRequest.ml +++ b/lib/js_of_ocaml/xmlHttpRequest.ml @@ -75,7 +75,7 @@ class type xmlHttpRequest = method response : File.file_any readonly_prop - method responseText : js_string t readonly_prop + method responseText : js_string t opt readonly_prop method responseXML : Dom.element Dom.document t opt readonly_prop diff --git a/lib/js_of_ocaml/xmlHttpRequest.mli b/lib/js_of_ocaml/xmlHttpRequest.mli index d7e4a2c68b..7db270235a 100644 --- a/lib/js_of_ocaml/xmlHttpRequest.mli +++ b/lib/js_of_ocaml/xmlHttpRequest.mli @@ -77,7 +77,7 @@ class type xmlHttpRequest = method response : File.file_any readonly_prop - method responseText : js_string t readonly_prop + method responseText : js_string t opt readonly_prop method responseXML : Dom.element Dom.document t opt readonly_prop diff --git a/lib/lwt/lwt_xmlHttpRequest.ml b/lib/lwt/lwt_xmlHttpRequest.ml index 9ae03bd015..f1b840bc47 100644 --- a/lib/lwt/lwt_xmlHttpRequest.ml +++ b/lib/lwt/lwt_xmlHttpRequest.ml @@ -48,7 +48,7 @@ exception Wrong_headers of (int * (string -> string option)) let default_response url code headers req = { url ; code - ; content = Js.to_string req##.responseText + ; content = Js.Opt.case req##.responseText (fun () -> "") (fun x -> Js.to_string x) ; content_xml = (fun () -> match Js.Opt.to_option req##.responseXML with @@ -59,7 +59,7 @@ let default_response url code headers req = let text_response url code headers req = { url ; code - ; content = req##.responseText + ; content = Js.Opt.case req##.responseText (fun () -> Js.string "") (fun x -> x) ; content_xml = (fun () -> assert false) ; headers }