// 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包請求結果http.get請求輸出結果出現亂碼 而這返回的不都是response 對象嗎 怎么一個亂碼 一個正常,,求解決
- 2 回答
- 0 關注
- 2684 瀏覽
添加回答
舉報
0/150
提交
取消