HTTP response data is encapsulated in the response. If we need to get the specific content of the response, we can simply get it through the following methods

package main import ( "fmt" "io/ioutil" "net/http" ) func responseBody(r *http.Response){ content, _ := ioutil.ReadAll(r.Body) fmt.Printf("%s", content) //{ // "args": {}, // "headers": { // "Accept-Encoding": "Gzip" / / "Host" : "httpbin.org", / / "the user-agent" : "Go - HTTP client / 1.1" / / "X - Amzn - Trace - Id" : "Root=1-60e46d3a-016b7ff6190e1c577abb9c40" //}, // "origin": "222.211.214.252", // "url": "http://httpbin.org/get" //}} func status(r * http.response){fmt.println (R.tatusCode) // 200 OK} func header(r * http.response){STR := R.Header.Get(" Content-Type ") fmt.println (STR)} func main(){resp,  err := http.Get("http://httpbin.org/get") if err ! = nil { panic(err) } defer func() {_ = resp.Body.Close()}() responseBody(resp) status(resp) header(resp) }