Skip to content

Commit

Permalink
This isn't just about API URL but it also checks the valid credential
Browse files Browse the repository at this point in the history
  • Loading branch information
kohsuke committed Mar 12, 2016
1 parent 3b764f9 commit 1954a9f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/org/kohsuke/github/GitHub.java
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,10 @@ void check(String apiUrl) throws IOException {
}

/**
* Ensures that the API URL is valid.
* Tests the connection.
*
* <p>
* Verify that the API URL and credentials are valid to access this GitHub.

This comment has been minimized.

Copy link
@recena

recena Mar 14, 2016

Contributor

This method no requires a valid credentials. It can be used with am anonymous user. At least, it was my initial intention before your modifications.

This comment has been minimized.

Copy link
@kohsuke

kohsuke Mar 14, 2016

Author Collaborator

OK, I got confused. Then "GitHub Enterprise server (" + apiUrl + ") with private mode enabled" exception shouldn't be thrown but it should return successfully.

This comment has been minimized.

Copy link
@recena

recena Mar 14, 2016

Contributor

This is the only way that I found to say: this seems a valid API endpoint but you are using a GHE with private mode and them I can not confirm it. You can find an use case here.

This comment has been minimized.

Copy link
@kohsuke

kohsuke Mar 15, 2016

Author Collaborator

As it stands now I think the documentation is correct that this method does test the validity of API and the credential to be able to make some calls. If not, you get an error message, and in this particular case of anonymous access to GHE that doesn't allow anonymous access, we just do a better error diagnosis to help assist users.

*
* <p>
* This method returns normally if the endpoint is reachable and verified to be GitHub API URL.
Expand Down

0 comments on commit 1954a9f

Please sign in to comment.