I am trying to get response from a json api, but I am getting <nil>
as a body. I dont know what is wrong. Here is code snippet
client := &http.Client{}
req, err := http.NewRequest("POST", "http://example.com",
bytes.NewBufferString("{\"a\": \"b\"}"))
resp, err := client.Do(req)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
var f interface{}
err = json.Unmarshal(body, &f)
fmt.Println(f);
Any help is highly appreciated