Skip to content

Add support for making OAuth2 requests #3

Merged
merged 1 commit into from Dec 9, 2011

2 participants

@arohner
Collaborator
arohner commented Dec 9, 2011

This commit adds support for making authenticated requests using the OAuth2 header token, if :oauth_token is supplied in the options map.

@Raynes
Owner
Raynes commented Dec 9, 2011

I am still not entirely sure of the best way to handle exceptional things. Some API calls that are predicates catch 404 exceptions and return false. This breaks those (though it is simple enough to fix). We also have the problem of "if we aren't throwing exceptions, then what are we doing?". I think that Github API requests return a JSON body for 404s and the like, so we might be okay leaving it just the way it is. If not, we'll have to do special things in safe-parse. I hope I'm right and it does, because returning a map is a thousand times better than throwing an exception and it certainly means less work.

I'll check this stuff out asap (tomorrow night at the latest) and pull this request. I appreciate contribution. I wasn't aware that it would be this easy to add oauth2 support. Furthermore, thanks for sneaking that little :throw-exceptions key in there. I had been putting off thinking about this problem for a bit too long. ;)

@arohner
Collaborator
arohner commented Dec 9, 2011

I actually didn't intend for the ":throw-exceptions false" to make it into the commit, I added it as a debug statement to figure out what was going on. Feel free to remove it, or I can make another commit to remove it.

Thanks for the quick response.

@Raynes
Owner
Raynes commented Dec 9, 2011

No, it's fine. I've been needing to address error handling anyways, like I said. I'm going to go ahead and merge.

@Raynes Raynes merged commit b8562a6 into Raynes:master Dec 9, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.