Golang Read Response Body

[Solved] Golang Read Response Body | Go - Code Explorer | yomemimo.com
Question : golang read response body

Answered by : ahmed-ali

//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)

Source : https://stackoverflow.com/questions/38673673/access-http-response-as-string-in-go | Last Update : Sun, 31 Jan 21

Answers related to golang read response body

Code Explorer Popular Question For Go