mirror of
https://github.com/AynaLivePlayer/AynaLivePlayer.git
synced 2025-12-06 10:22:50 +08:00
30 lines
616 B
Go
30 lines
616 B
Go
package provider
|
|
|
|
import (
|
|
"github.com/go-resty/resty/v2"
|
|
"time"
|
|
)
|
|
|
|
func httpGet(url string, header map[string]string) (*resty.Response, error) {
|
|
resp, err := resty.New().
|
|
SetTimeout(time.Second * 3).R().
|
|
SetHeaders(header).
|
|
Get(url)
|
|
return resp, err
|
|
}
|
|
func httpGetString(url string, header map[string]string) string {
|
|
resp, err := httpGet(url, header)
|
|
if err != nil {
|
|
return ""
|
|
}
|
|
return resp.String()
|
|
}
|
|
|
|
func httpHead(url string, header map[string]string) (*resty.Response, error) {
|
|
resp, err := resty.New().
|
|
SetTimeout(time.Second * 3).R().
|
|
SetHeaders(header).
|
|
Head(url)
|
|
return resp, err
|
|
}
|