1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 11:07:40 +08: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
No known key found for this signature in database
GPG Key ID: 3186E98FA19CE3A7

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)
}