Answers for "golang get request data"

Go
0

golang get request data

package main

func fetchResponse(url string) string{
	resp, _ := http.Get(url)	
	defer resp.Body.Close()
	body, _ := ioutil.ReadAll(resp.Body)
	return string(body)
}

func main() {	
	resp := fetchResponse("http://someurl.com")
	fmt.Println(resp)
}
Posted by: Guest on October-20-2020

Browse Popular Code Answers by Language