Skip to content
This repository has been archived by the owner on Jan 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #9 from php-http/response_builder
Browse files Browse the repository at this point in the history
Require a Response factory in Client
  • Loading branch information
Nyholm authored Jul 18, 2016
2 parents e3a63fe + 80b8fdb commit f3a7d58
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Change Log


## UNRELEASED

### Changed

- Client now requires a Response factory instead of a Message factory


## 0.2.0 - 2016-06-28

### Changed
Expand Down
14 changes: 7 additions & 7 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Buzz\Message\Response as BuzzResponse;
use Http\Client\HttpClient;
use Http\Discovery\MessageFactoryDiscovery;
use Http\Message\MessageFactory;
use Http\Message\ResponseFactory;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Http\Client\Exception as HttplugException;
Expand All @@ -28,15 +28,15 @@ class Client implements HttpClient
private $client;

/**
* @var MessageFactory
* @var ResponseFactory
*/
private $messageFactory;
private $responseFactory;

/**
* @param ClientInterface|Browser|null $client
* @param MessageFactory|null $messageFactory
* @param ResponseFactory|null $responseFactory
*/
public function __construct($client = null, MessageFactory $messageFactory = null)
public function __construct($client = null, ResponseFactory $responseFactory = null)
{
$this->client = $client;

Expand All @@ -56,7 +56,7 @@ public function __construct($client = null, MessageFactory $messageFactory = nul
);
}

$this->messageFactory = $messageFactory ?: MessageFactoryDiscovery::find();
$this->responseFactory = $responseFactory ?: MessageFactoryDiscovery::find();
}

/**
Expand Down Expand Up @@ -109,7 +109,7 @@ private function createResponse(BuzzResponse $response)
{
$body = $response->getContent();

return $this->messageFactory->createResponse(
return $this->responseFactory->createResponse(
$response->getStatusCode(),
null,
$this->getBuzzHeaders($response),
Expand Down

0 comments on commit f3a7d58

Please sign in to comment.