golang print response body code example
Example: golang read response body
//import package
import "io/ioutil"
//code snippet
bodyBytes, err := ioutil.ReadAll(resp.Body)
//---------- optioninal ---------------------
//handling Errors
if err != nil {
log.Fatal(err)
}
//print result
bodyString := string(bodyBytes)
log.Info(bodyString)