Module Js_of_ocaml_lwt.XmlHttpRequest
include Js_of_ocaml.XmlHttpRequest
type readyState=|UNSENT|OPENED|HEADERS_RECEIVED|LOADING|DONEtype _ response=|ArrayBuffer : Js_of_ocaml.Typed_array.arrayBuffer Js_of_ocaml.Js.t Js_of_ocaml.Js.Opt.t response|Blob : Js_of_ocaml__.File.#blob Js_of_ocaml.Js.t Js_of_ocaml.Js.Opt.t response|Document : Js_of_ocaml.Dom.element Js_of_ocaml.Dom.document Js_of_ocaml.Js.t Js_of_ocaml.Js.Opt.t response|JSON : 'a Js_of_ocaml.Js.Opt.t response|Text : Js_of_ocaml.Js.js_string Js_of_ocaml.Js.t response|Default : string response
class type xmlHttpRequest = object ... endand xmlHttpRequestUpload = object ... endval create : unit -> xmlHttpRequest Js_of_ocaml.Js.t
module Event = Js_of_ocaml.XmlHttpRequest.Eventinclude Js_of_ocaml_lwt__.Lwt_xmlHttpRequest
type 'response generic_http_frame={url : string;code : int;headers : string -> string option;content : 'response;content_xml : unit -> Js_of_ocaml.Dom.element Js_of_ocaml.Dom.document Js_of_ocaml.Js.t option;}The type for XHR results. The code field is the http status code of the answer. The headers field is a function associating values to any header name.
type http_frame= string generic_http_frame
exceptionWrong_headers of int * (string -> string option)The exception raise by perform functions when the check_headers parameter returned false. The parameter of the exception is a function is like the
headersfunction ofhttp_frame
val perform_raw : ?headers:(string * string) list -> ?content_type:string -> ?get_args:(string * string) list -> ?check_headers:(int -> (string -> string option) -> bool) -> ?progress:(int -> int -> unit) -> ?upload_progress:(int -> int -> unit) -> ?contents:[< `POST_form of (string * Js_of_ocaml.Form.form_elt) list | `Form_contents of Js_of_ocaml.Form.form_contents | `String of string | `Blob of Js_of_ocaml.File.#blob Js_of_ocaml.Js.t ] -> ?override_mime_type:string -> ?override_method:[< `GET | `POST | `HEAD | `PUT | `DELETE | `OPTIONS | `PATCH ] -> ?with_credentials:bool -> response_type:'a Js_of_ocaml.XmlHttpRequest.response -> string -> 'a generic_http_frame Lwt.tperform_rawis the same asperform_raw_urlexcept that an additional response_type argument can be given to set the XMLHttpRequest responseType, and hence return different types of data for GET requests.
val perform_raw_url : ?headers:(string * string) list -> ?content_type:string -> ?get_args:(string * string) list -> ?check_headers:(int -> (string -> string option) -> bool) -> ?progress:(int -> int -> unit) -> ?upload_progress:(int -> int -> unit) -> ?contents:[< `POST_form of (string * Js_of_ocaml.Form.form_elt) list | `Form_contents of Js_of_ocaml.Form.form_contents | `String of string | `Blob of Js_of_ocaml.File.#blob Js_of_ocaml.Js.t ] -> ?override_mime_type:string -> ?override_method:[< `GET | `POST | `HEAD | `PUT | `DELETE | `OPTIONS | `PATCH ] -> ?with_credentials:bool -> string -> http_frame Lwt.tperform_raw_urlmakes an asynchronous request to the specifiedurlwith specified options. The result is a cancelable thread returning an HTTP frame. By default, ifpost_argsandform_argareNone, a GET request is used. Ifpost_argsorform_argisSome _(evenSome []) then a POST request is made. But ifoverride_methodis set, the request method is forced, no matter thepost_argsorform_argvalue. For example, withoverride_methodset to`PUTandform_argset toSome _a PUT request including the form data will be made. Thecheck_headersargument is run as soon as the answer code and headers are available. If it returns false, the request is canceled and the functions raise theWrong_headersexception
val perform : ?headers:(string * string) list -> ?content_type:string -> ?get_args:(string * string) list -> ?check_headers:(int -> (string -> string option) -> bool) -> ?progress:(int -> int -> unit) -> ?upload_progress:(int -> int -> unit) -> ?contents:[< `POST_form of (string * Js_of_ocaml.Form.form_elt) list | `Form_contents of Js_of_ocaml.Form.form_contents | `String of string | `Blob of Js_of_ocaml.File.#blob Js_of_ocaml.Js.t ] -> ?override_mime_type:string -> ?override_method:[< `GET | `POST | `HEAD | `PUT | `DELETE | `OPTIONS | `PATCH ] -> ?with_credentials:bool -> Js_of_ocaml.Url.url -> http_frame Lwt.tperformis the same asperform_raw_urlexcept that the Url argument has typeUrl.url.
val get : string -> http_frame Lwt.tget urlmakes an asynchronous request to the specifiedurl