mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
23 lines
320 B
Go
23 lines
320 B
Go
package utils
|
|
|
|
import (
|
|
"bytes"
|
|
"io/ioutil"
|
|
"net/http"
|
|
)
|
|
|
|
func HttpRequestGET(url string) (string, error) {
|
|
rsp, err := http.Get(url)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
defer rsp.Body.Close()
|
|
|
|
buf, err := ioutil.ReadAll(rsp.Body)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
return string(bytes.TrimSpace(buf)), nil
|
|
}
|