Skip to content

Commit

Permalink
Merge 315454c into 01bed92
Browse files Browse the repository at this point in the history
  • Loading branch information
andytson-inviqa committed Feb 11, 2020
2 parents 01bed92 + 315454c commit 7b27305
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/BaseRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ protected function setupAuthentication(IO\IOInterface $io, $useRedirector, array

// is github
if (in_array($authKey, $githubDomains) && 'x-oauth-basic' === $auth['password']) {
$this->addParam('access_token', $auth['username']);
$this->addHeader('authorization', 'token ' . $auth['username']);
$this->user = $this->pass = null;
return;
}
Expand Down
6 changes: 4 additions & 2 deletions tests/unit/CopyRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,13 @@ public function testGitHubRedirector()

// user:pass -> query
$req = new CopyRequest($example, $tmpfile, false, $this->iop->reveal(), $this->configp->reveal());
$this->assertEquals("$example&access_token=at", $req->getURL());
$opts = $req->getCurlOptions();
$this->assertContains('Authorization: token at', $opts[CURLOPT_HTTPHEADER]);

// api.github.com -> codeload.github.com
$req = new CopyRequest($example, $tmpfile, true, $this->iop->reveal(), $this->configp->reveal());
$this->assertEquals('https://codeload.github.com/vendor/name/legacy.zip/aaaa?a=b&access_token=at', $req->getURL());
$opts = $req->getCurlOptions();
$this->assertContains('Authorization: token at', $opts[CURLOPT_HTTPHEADER]);
}

public function testGitLab()
Expand Down

0 comments on commit 7b27305

Please sign in to comment.