1
0
Fork 0
mirror of https://github.com/m1k1o/neko.git synced 2025-05-19 12:07:06 +02:00
neko/internal/utils/request.go
2021-08-29 17:12:37 +02:00

22 lines
309 B
Go

package utils
import (
"bytes"
"io"
"net/http"
)
func HttpRequestGET(url string) (string, error) {
rsp, err := http.Get(url)
if err != nil {
return "", err
}
defer rsp.Body.Close()
buf, err := io.ReadAll(rsp.Body)
if err != nil {
return "", err
}
return string(bytes.TrimSpace(buf)), nil
}