Net/http is an amazing package but there are times you need to work with the body text of the response returned from the call you just made. Many functions require a as input so we have to it first by passing it through a buffer.
package main import ( "fmt" "net/http" "bytes" ) func main() { response, _ := http.Get("https://golangcode.com/") // The line below would fail because Body = io.



Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here