Skip to content

Commit

Permalink
allows HTTP Basic Auth with username only
Browse files Browse the repository at this point in the history
  • Loading branch information
KuiKui committed Dec 10, 2015
1 parent 780c99e commit 45a4eb3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/Request.php
@@ -1,7 +1,7 @@
<?php
/**
* PHP OOP cURL
*
*
* @author Andreas Lutro <anlutro@gmail.com>
* @license http://opensource.org/licenses/MIT
* @package PHP cURL
Expand Down Expand Up @@ -162,7 +162,7 @@ public function setHeader($key, $value = null)

/**
* Set the headers to be sent with the request.
*
*
* Pass an associative array - e.g. ['Content-Type' => 'application/json']
* and the correct header formatting - e.g. 'Content-Type: application/json'
* will be done for you when the request is sent.
Expand Down Expand Up @@ -466,7 +466,7 @@ public function setPass($pass)
*/
public function getUserAndPass()
{
if ($this->user && $this->pass) {
if ($this->user) {
return $this->user . ':' . $this->pass;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/RequestTest.php
Expand Up @@ -96,7 +96,7 @@ public function userAndPass()
$r = $this->makeRequest();
$this->assertEquals(null, $r->getUserAndPass());
$r->setUser('foo');
$this->assertEquals(null, $r->getUserAndPass());
$this->assertEquals('foo:', $r->getUserAndPass());
$r->setPass('bar');
$this->assertEquals('foo:bar', $r->getUserAndPass());
}
Expand Down

0 comments on commit 45a4eb3

Please sign in to comment.