无法理解有什么问题。ioutil.ReadAll 应该像其他 URL 一样使用 gzip。
可通过 URL 重现:romboutskorea.co.kr
错误:
gzip:无效的标头
代码:
resp, err := http.Get("http://" + url)
if err == nil {
defer resp.Body.Close()
if resp.StatusCode == http.StatusOK {
fmt.Printf("HTTP Response Status : %v\n", resp.StatusCode)
bodyBytes, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Printf("HTTP Response Read error. Url: %v\n", url)
log.Fatal(err)
}
bodyString := string(bodyBytes)
fmt.Printf("HTTP Response Content Length : %v\n", len(bodyString))
}
}
PIPIONE
千万里不及你
相关分类