sig
type http_method = Get | Post | Head | Put | Delete
type status =
Ok
| Created
| Accepted
| NoContent
| ResetContent
| PartialContent
| MultipleChoices
| MovedPermanently
| MovedTemporarily
| NotModified
| BadRequest
| Unauthorized
| Forbidden
| NotFound
| RangeNotSatisfiable
| InternalServerError
| NotImplemented
| BadGateway
| ServiceNotAvailable
| GatewayTimeout
| VersionNotSupported
| InvalidResponse
| ConnectionFailed
module Request :
sig
type t
external create : unit -> SFHttp.Request.t
= "caml_sfHttpRequest_create"
external destroy : SFHttp.Request.t -> unit
= "caml_sfHttpRequest_destroy"
external setField :
SFHttp.Request.t -> field:string -> value:string -> unit
= "caml_sfHttpRequest_setField"
external setMethod : SFHttp.Request.t -> SFHttp.http_method -> unit
= "caml_sfHttpRequest_setMethod"
external setUri : SFHttp.Request.t -> uri:string -> unit
= "caml_sfHttpRequest_setUri"
external setHttpVersion :
SFHttp.Request.t -> major:int -> minor:int -> unit
= "caml_sfHttpRequest_setHttpVersion"
external setBody : SFHttp.Request.t -> body:string -> unit
= "caml_sfHttpRequest_setBody"
end
module Response :
sig
type t
external getBody : SFHttp.Response.t -> string
= "caml_sfHttpResponse_getBody"
external getStatus : SFHttp.Response.t -> SFHttp.status
= "caml_sfHttpResponse_getStatus"
external destroy : SFHttp.Response.t -> unit
= "caml_sfHttpResponse_destroy"
external getField : SFHttp.Response.t -> field:string -> string
= "caml_sfHttpResponse_getField"
external getMajorHttpVersion : SFHttp.Response.t -> int
= "caml_sfHttpResponse_getMajorHttpVersion"
external getMinorHttpVersion : SFHttp.Response.t -> int
= "caml_sfHttpResponse_getMinorHttpVersion"
end
type t
external create : unit -> SFHttp.t = "caml_sfHttp_create"
external destroy : SFHttp.t -> unit = "caml_sfHttp_destroy"
external setHost : SFHttp.t -> host:string -> ?port:int -> unit -> unit
= "caml_sfHttp_setHost"
external sendRequest :
SFHttp.t ->
request:SFHttp.Request.t ->
?timeout:SFTime.t -> unit -> SFHttp.Response.t
= "caml_sfHttp_sendRequest"
end