mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-06 15:20:22 +00:00
✏️ drop all pb & 增加 gist 审批
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io"
|
||||
"net/http"
|
||||
)
|
||||
@@ -23,3 +24,18 @@ func ReqWith(url string, method string, referer string, ua string) (data []byte,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func GetData(url string) (data []byte, err error) {
|
||||
var response *http.Response
|
||||
response, err = http.Get(url)
|
||||
if err == nil {
|
||||
if response.ContentLength <= 0 {
|
||||
err = errors.New("web.GetData: empty body")
|
||||
response.Body.Close()
|
||||
return
|
||||
}
|
||||
data, err = io.ReadAll(response.Body)
|
||||
response.Body.Close()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user