Movatterモバイル変換


[0]ホーム

URL:


ModuleCohttp_lwt_unix.Client

TheClient module implements the full UNIX HTTP client interface, including the UNIX-specific functions defined inC.

includeCohttp_lwt.S.Clientwithtypectx =Net.ctx
type ctx =Net.ctx
  • parameterctx

    If provided, no connection cache is used, butConnection_cache.Make_no_cache.create is used to resolve uri and create a dedicated connection withctx.

    In most cases you should use the more specific helper calls in the interface rather than invoke this function directly. Seehead,get andpost for some examples.

includeCohttp.Generic.Client.Swithtype'aio ='aLwt.tandtypebody =Cohttp_lwt.Body.tandtype'awith_context =?ctx:ctx->'a
type'a io ='aLwt.t
type'a with_context =?ctx:ctx->'a
val map_context :'awith_context->('a->'b)->'bwith_context
val call :(?headers:Http.Header.t->?body:body->?chunked:bool->Http.Method.t->Uri.t->(Http.Response.t *body)io)with_context

call ?headers ?body ?chunked meth uri

  • returns

    (response, response_body) Consumeresponse_body in a timely fashion. Please seecall about how and why.

  • parameterchunked

    use chunked encoding iftrue. The default isfalse for compatibility reasons.

val head :(?headers:Http.Header.t->Uri.t->Http.Response.tio)with_context
val get :(?headers:Http.Header.t->Uri.t->(Http.Response.t *body)io)with_context
val delete :(?body:body->?chunked:bool->?headers:Http.Header.t->Uri.t->(Http.Response.t *body)io)with_context
val post :(?body:body->?chunked:bool->?headers:Http.Header.t->Uri.t->(Http.Response.t *body)io)with_context
val put :(?body:body->?chunked:bool->?headers:Http.Header.t->Uri.t->(Http.Response.t *body)io)with_context
val patch :(?body:body->?chunked:bool->?headers:Http.Header.t->Uri.t->(Http.Response.t *body)io)with_context
val set_cache :Cohttp_lwt.S.call-> unit

Provide a function used to process requests. Please seecall. The provided function is only used when noctx argument is passed to the convenience functions below.

val post_form :?ctx:ctx->?headers:Http.Header.t->params:(string *string list) list->Uri.t->(Http.Response.t *Cohttp_lwt.Body.t)Lwt.t
val callv :?ctx:ctx->Uri.t->(Http.Request.t *Cohttp_lwt.Body.t)Lwt_stream.t->(Http.Response.t *Cohttp_lwt.Body.t)Lwt_stream.tLwt.t
val custom_ctx :?ctx:Conduit_lwt_unix.ctx->?resolver:Resolver_lwt.t->unit->Net.ctx

custom_ctx ?ctx ?resolver () will return a context that is the same as thedefault_ctx, but with either the connection handling or resolution module overridden withctx orresolver respectively. This is useful to supply aConduit_lwt_unix.ctx with a custom source network interface, or aResolver_lwt.t with a different name resolution strategy (for instance to override a hostname to point it to a Unix domain socket).


[8]ページ先頭

©2009-2025 Movatter.jp