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

Commit

Permalink
set up guzzle client as very minimal, not throwing exceptions for HTT…
Browse files Browse the repository at this point in the history
…P status codes, not following redirects, not handling cookies
  • Loading branch information
dbu committed Dec 16, 2015
1 parent b9d4024 commit 5e4fdd8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

### Unreleased

### Changed

- Guzzle setup conforms to HTTPlug requirement now: Minimal functionality in client

## 0.2.0 - 2015-12-15

Expand Down
9 changes: 8 additions & 1 deletion src/Guzzle6HttpAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Middleware;
use Http\Client\HttpAsyncClient;
use Http\Client\HttpClient;
use Http\Client\Tools\HttpClientEmulator;
Expand All @@ -28,7 +30,12 @@ class Guzzle6HttpAdapter implements HttpClient, HttpAsyncClient
*/
public function __construct(ClientInterface $client = null)
{
$this->client = $client ?: new Client();
if (!$client) {
$handlerStack = new HandlerStack();
$handlerStack->push(Middleware::prepareBody(), 'prepare_body');
$client = new Client(['handler' => $handlerStack]);
}
$this->client = $client;
}

/**
Expand Down

0 comments on commit 5e4fdd8

Please sign in to comment.