Add global DefaultClient (readonly), WithUserAgent option

Signed-off-by: Vartan Benohanian <vartanbeno@gmail.com>
This commit is contained in:
Vartan Benohanian
2020-08-29 02:48:22 -04:00
parent aac3b48d6e
commit 37e712b334
11 changed files with 260 additions and 142 deletions
+2
View File
@@ -18,6 +18,8 @@ func cloneRequest(r *http.Request) *http.Request {
}
// Sets the User-Agent header for requests.
// We need to set a custom user agent because using the one set by the
// stdlib gives us 429 Too Many Requests responses from the Reddit API.
type userAgentTransport struct {
userAgent string
Base http.RoundTripper