问题
Does anyone know how to do this?
回答1:
You need to append your request with the header info, using the <:< operator. Like this :
url("http://example.com") <:< Map("User-Agent" -> "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)")
回答2:
Just from reading the source, it looks like you're supposed to call http.client.params.setParameter("User-Agent","Cowbells") on your Http object. Have you tried this?
回答3:
This will work as well:
url("http://example.com").addHeader("User-Agent", "Mozilla...")
来源:https://stackoverflow.com/questions/1394667/setting-user-agent-header-in-scala-with-databinders-dispatch-library