1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-06-30 20:03:25 +00:00

fix: nil pointer deference on HttpGetBytes.

This commit is contained in:
Mrs4s
2021-10-15 11:34:55 +08:00
parent 2309d511bb
commit 6e4bbb9e42

View File

@ -20,10 +20,10 @@ var client = &http.Client{
// HttpGetBytes 带 cookie 的 GET 请求
func HttpGetBytes(url, cookie string) ([]byte, error) {
body, err := HTTPGetReadCloser(url, cookie)
defer func() { _ = body.Close() }()
if err != nil {
return nil, err
}
defer func() { _ = body.Close() }()
return io.ReadAll(body)
}