diff --git a/src/Composer/Command/DiagnoseCommand.php b/src/Composer/Command/DiagnoseCommand.php index e2301c813..16add1e33 100644 --- a/src/Composer/Command/DiagnoseCommand.php +++ b/src/Composer/Command/DiagnoseCommand.php @@ -286,7 +286,7 @@ EOT { $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic'); try { - $url = $domain === 'github.com' ? 'https://api.'.$domain.'/user/repos' : 'https://'.$domain.'/api/v3/user/repos'; + $url = $domain === 'github.com' ? 'https://api.'.$domain.'/' : 'https://'.$domain.'/api/v3/'; return $this->rfs->getContents($domain, $url, false, array( 'retry-auth-failure' => false, diff --git a/src/Composer/Util/GitHub.php b/src/Composer/Util/GitHub.php index 10cb2dc71..a8fd3dc70 100644 --- a/src/Composer/Util/GitHub.php +++ b/src/Composer/Util/GitHub.php @@ -102,7 +102,7 @@ class GitHub $this->io->setAuthentication($originUrl, $token, 'x-oauth-basic'); try { - $apiUrl = ('github.com' === $originUrl) ? 'api.github.com' : $originUrl . '/api/v3'; + $apiUrl = ('github.com' === $originUrl) ? 'api.github.com/' : $originUrl . '/api/v3/'; $this->remoteFilesystem->getContents($originUrl, 'https://'. $apiUrl, false, array( 'retry-auth-failure' => false, diff --git a/tests/Composer/Test/Repository/Vcs/GitHubDriverTest.php b/tests/Composer/Test/Repository/Vcs/GitHubDriverTest.php index f1e51fefd..30179a1a9 100644 --- a/tests/Composer/Test/Repository/Vcs/GitHubDriverTest.php +++ b/tests/Composer/Test/Repository/Vcs/GitHubDriverTest.php @@ -78,7 +78,7 @@ class GitHubDriverTest extends TestCase $remoteFilesystem->expects($this->at(1)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo('https://api.github.com'), $this->equalTo(false)) + ->with($this->equalTo('github.com'), $this->equalTo('https://api.github.com/'), $this->equalTo(false)) ->will($this->returnValue('{}')); $remoteFilesystem->expects($this->at(2)) diff --git a/tests/Composer/Test/Util/GitHubTest.php b/tests/Composer/Test/Util/GitHubTest.php index ff245004a..c7d4061e1 100644 --- a/tests/Composer/Test/Util/GitHubTest.php +++ b/tests/Composer/Test/Util/GitHubTest.php @@ -50,7 +50,7 @@ class GitHubTest extends \PHPUnit_Framework_TestCase ->method('getContents') ->with( $this->equalTo($this->origin), - $this->equalTo(sprintf('https://api.%s', $this->origin)), + $this->equalTo(sprintf('https://api.%s/', $this->origin)), $this->isFalse(), $this->anything() )