【问题标题】:Setting User-Agent Header in Scala with Databinders Dispatch Library使用 Databinders Dispatch Library 在 Scala 中设置 User-Agent 标头
【发布时间】:2010-11-26 13:13:30
【问题描述】:

有人知道怎么做吗?

【问题讨论】:

    标签: scala scala-dispatch


    【解决方案1】:

    您需要使用 <:>

    url("http://example.com") <:< Map("User-Agent" -> "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)") 
    

    【讨论】:

      【解决方案2】:

      仅从阅读源代码来看,您似乎应该在您的 Http 对象上调用 http.client.params.setParameter("User-Agent","Cowbells") 。你试过吗?

      【讨论】:

        【解决方案3】:

        This 也可以:

        url("http://example.com").addHeader("User-Agent", "Mozilla...")
        

        【讨论】:

          猜你喜欢
          • 2014-05-03
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2013-03-31
          • 1970-01-01
          • 2020-06-02
          • 1970-01-01
          相关资源
          最近更新 更多