This commit is contained in:
TJ Horner
2019-02-28 11:47:50 -08:00
commit bdc166c445
11 changed files with 357 additions and 0 deletions

16
util.go Normal file
View File

@@ -0,0 +1,16 @@
package main
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)
}