cameronstanley / go-reddit

Golang Reddit API Wrapper
MIT License
18 stars 12 forks source link

Set User-Agent when calling Exchange() #3

Closed rmichela closed 7 years ago

rmichela commented 7 years ago

Google's oauth2 library doesn't allow the User-Agent header to be set when calling Exchange(). Lacking a User-Agent, Reddit's API frequently returns a HTTP 429 (Too many requests) error. Reddit really wants you to use a custom User-Agent header with every request.

In this PR I used the cryptic instructions from Google in this Github issue to add a User-Agent header to the Exchange() request manually. This is kind of a hack, but Google acknowledges the need for it.

cameronstanley commented 7 years ago

Awesome work, thanks for fixing this!