dongwopu8210 2016-12-29 08:16
浏览 40
已采纳

如何忽略golang的内容类型?

can somebody tell me how to ignore content type with go? I can invoke ignoreContentType method in Jsoup with java, but i can't find any method in go can do like that. Hope someone will tell me, thanks.

Connection.Response response = Jsoup.connect("http://example.com/")
            .ignoreContentType(true)
            .execute();
System.out.println(response.body());
  • 写回答

2条回答 默认 最新

  • donglaoe2979 2017-01-03 08:25
    关注

    I have solved my problem after read Jsoup's source code, just set the response header

    resp.Header.Set("Transfer-Encoding", "chunked")
    resp.Header.Set("Content-Type", "application/json")
    

    thanks you guys.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码