quantum-inspiration / commit
add user agent
http-cache.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/http-cache.go b/http-cache.go index ccac112..d46ad84 100644 --- a/http-cache.go +++ b/http-cache.go @@ -51,7 +51,15 @@ func getCachedUrlFunc( } return bytes, nil } else { - resp, err := http.Get(url) + client := http.Client{} + + req, err := http.NewRequest("GET", url, nil) + if err != nil { + return nil, err + } + req.Header.Set("User-Agent", "QuantumInspirationBot/1.0 (https://pavelsafronov.gitlab.io/quantum-inspiration/)") + + resp, err := client.Do(req) if err != nil { return nil, err }