如何在ocamlnet的netclient中设置Http

系统教程 行业动态 更新时间:2024-06-14 16:53:07
如何在ocamlnet的netclient中设置Http_client的用户代理?(How to set user agent of Http_client in netclient of ocamlnet?)

也许我错过了一些明显的东西,但文档并没有向我透露任何东西。

解决方案或解决方法将非常有用。

Maybe I'm missing something obvious but the docs aren't revealing me anything.

Solution or workaround would be very helpful.

最满意答案

使用方法set_req_header : string -> string -> unit :

let req = new Http_client.get (Neturl.string_of_url some_url) in req#set_req_header "User-Agent" "Your user agent";

而不是提出你的要求。

Use method set_req_header : string -> string -> unit:

let req = new Http_client.get (Neturl.string_of_url some_url) in req#set_req_header "User-Agent" "Your user agent";

And than make your request.

更多推荐

本文发布于:2023-04-05 21:08:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/8618408b506fb1022fd357505eabb5cb.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何在   ocamlnet   Http   netclient

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!