go-flickr icon indicating copy to clipboard operation
go-flickr copied to clipboard

Close bug

Open BoxuanXu opened this issue 5 years ago • 0 comments

hello,here is a bug,if err is not nil, then defer res.Body.Close(),will panic. `func (request *Request) Execute() (response string, ret error) { if request.ApiKey == "" || request.Method == "" { return "", Error("Need both API key and method") }

s := request.URL()

res, err := http.Get(s)
defer res.Body.Close()
if err != nil {
	return "", err
}

body, _ := ioutil.ReadAll(res.Body)
return string(body), nil

}`

BoxuanXu avatar May 16 '20 08:05 BoxuanXu