-
Notifications
You must be signed in to change notification settings - Fork 736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider committing to using OkHttp in preference to HttpURLConnection #104
Comments
I'm open to be persuaded, but right now my feeling is that the cost outweighs the benefit.
I assume the main motivation for you is to be able to expose asynchornous operations, but that'd require a vastly different API surface, as all the methods exposed today in this library is fundamentally synchronous. What kind of API do you foresee that leverages the underlying asynchrony? How do you benefit from that? |
I don't really have solid answers to the questions you pose, just thought using OkHttp in preference to HttpURLConnection was worth considering!
One thing that OkHttp does, that I'm not aware of other libraries doing very well, is the caching-support for conditional requests. Reducing the consumption of API quota definitely is of benefit to users- I'd almost be prepared to argue that the majority of users should be using it, so surely the majority of users are going to need OkHttp anyway... 😄
The interface of |
Helped me to avoid rate-limits :) Bad that it doesn't support in-memory cache configuration. |
I've filed conditional request support as #168. I'm closing this issue as WONTFIX. |
This blogpost explains the advantages of OkHttp's interface over
HttpURLConnection
- it neatly supports separation of Request and Response, and offers an asynchronous Call interface:http://corner.squareup.com/2014/06/okhttp-2.html
In order for
github-api
to take full advantage of the superior OkHttp API - and to expose it to external users so that users can do async calls to the GitHub API - would probably require commiting to using OkHttp everywhere within thegithub-api
library, removing all usage of HttpURLConnection. This might feel like a big change, but it's mostly an internal one, so hopefully would not substantially impact consumers of the library, other than offering them additional functionality.Amongst it's many consumers, OkHttp is also the engine that powers HttpUrlConnection as of Android 4.4, so it's a library that has a lot of traction and support.
See the OkHttp 'Recipes' documentation for code usage examples.
Would there be any interest in a pull-request that made this happen?
The text was updated successfully, but these errors were encountered: