// testpackage mainimport ( "io/ioutil" "net/http" "os" "github.com/mozillazg/request")func main() { c := &http.Client{} req := request.NewRequest(c) resp, _ := req.Get("http://segmentfault.com/") defer resp.Body.Close() // **Don't forget close the response body** body, _ := ioutil.ReadAll(resp.Body) fr, _ := os.Create("request.html") fr.Write(body) res, _ := http.Get("http://segmentfault.com/") truebody, _ := ioutil.ReadAll(res.Body) res.Body.Close() ft, _ := os.Create("get.html") ft.Write(truebody)}request包請(qǐng)求結(jié)果http.get請(qǐng)求輸出結(jié)果出現(xiàn)亂碼 而這返回的不都是response 對(duì)象嗎 怎么一個(gè)亂碼 一個(gè)正常,,求解決
- 2 回答
- 0 關(guān)注
- 2694 瀏覽
添加回答
舉報(bào)
0/150
提交
取消