e6dl/e621/util.go

17 lines
356 B
Go
Raw Normal View History

2019-03-14 03:16:40 +08:00
package e621
2019-03-01 03:47:50 +08:00
import (
"net/http"
)
// HTTPGet is a helper function that automatically adds the
// tool's UA to an HTTP GET request
func HTTPGet(url string) (*http.Response, error) {
client := &http.Client{}
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("User-Agent", "e6dl: go edition (@tjhorner on Telegram)")
return client.Do(req)
}