Ocaml 我应该在Http_client.concility.Http_post中将'header'和'data'放在哪里?
ocamlnet3具有Ocaml 我应该在Http_client.concility.Http_post中将'header'和'data'放在哪里?,ocaml,Ocaml,ocamlnet3具有Http\u client.convency.Http\u post 其API如下所示: val http_post:string->(string*string)列表->字符串 使用给定URL执行“POST”请求并返回响应 身体。该列表包含随POST请求一起发送的参数 我的问题是:: 我应该在哪里为post请求提供标头和数据体?AFAIR您不能以方便的方式提供自定义标头。但是,您始终可以使用管道API: let _ = let call = new Http_cl
Http\u client.convency.Http\u post
其API如下所示:
val http_post:string->(string*string)列表->字符串
使用给定URL执行“POST”请求并返回响应
身体。该列表包含随POST请求一起发送的参数
我的问题是::
我应该在哪里为
post请求提供标头和数据体?AFAIR您不能以方便的方式提供自定义标头。但是,您始终可以使用管道API:
let _ =
let call = new Http_client.post
"http://localhost:8080"
[("param", "value")]
in
call#set_req_header "User-Agent" "Foozilla 1.0";
call#set_req_header "Myheader" "foo";
let pipeline = new Http_client.pipeline in
pipeline#add call;
pipeline#run ();