This is much more reasonable way to address this issue.
When the Requester detects a 404 response with an ETag (only happpens when the server's 304
is bogus and would cause cache corruption), try the query again with new request header
that forces the server to not return 304 and return new data instead.
Ths solution is transparent to users of this library and autmatically fixes a situation that
was causing cache corruption. If GitHub ever fixes the issue and begins providing accurate
ETags to their 404 responses, this will result in two calls being made for each 404 response.
While that would be unfortunate, it would still be better than the current situation.
URI path encoding whack-a-mole. This fix should cover a significant number of cases.
Also, fixed to NOT do URLEncode for URI path. The encoding is different between path and query.
Fixes#624
This may be controversial but it we're doing it. Having code formatting needs to be consistent
and a non-issue during code review. I'm willing modify the configuration if people see a strong
need, but formatting needs to be present and enforced.
When the OTP code is requested, then the special GHOTPRequiredException
is raised instead of the generic IOException. This differentiates
between an OTP request and a failed password.
Created GHRateLimit.Record
Add the four rate limit records to GHRateLimit
Moved getLimt(), getRemaining(), and so on to point to core record for ease of use.
Fixed update check for header to not replace existing with older when remaining count is lower.
NOTE: Did not expose records other than core and did not resolve header update behavior to respect non-core records.
Fixed issue with getCodeFrequency() where it would occasionally throw
an exception when the statistics were still being generated.
Added comment about throwing an exception as a possibility when
202 is returned.
For now if invalid credentials used to search github-api throws following exception
Exception in thread "main" org.kohsuke.github.GHException: Failed to retrieve https://api.github.com/search/repositories?q=vk+language%3Ajava+created%3A2015-11-26..2016-11-26
at org.kohsuke.github.Requester$PagingIterator.fetch(Requester.java:529)
at org.kohsuke.github.Requester$PagingIterator.hasNext(Requester.java:494)
at org.kohsuke.github.PagedSearchIterable$1.hasNext(PagedSearchIterable.java:55)
at org.kohsuke.github.PagedIterator.fetch(PagedIterator.java:44)
at org.kohsuke.github.PagedIterator.hasNext(PagedIterator.java:32)
There is no mentions if credentials at all. Better to propagate exception to user to be able to deal with it.