如何在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.
更多推荐
发布评论