Skip to content

Commit

Permalink
Merge pull request #2113 from tarjei/docs-patch-1
Browse files Browse the repository at this point in the history
Clean up variable naming to make docs a bit clearer
  • Loading branch information
sagikazarmark committed Jul 28, 2018
2 parents 7bc46be + 8eb20b4 commit 9133fe0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions docs/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ a response or exception by shifting return values off of a queue.
new RequestException("Error Communicating with Server", new Request('GET', 'test'))
]);
$handler = HandlerStack::create($mock);
$client = new Client(['handler' => $handler]);
$handlerStack = HandlerStack::create($mock);
$client = new Client(['handler' => $handlerStack]);
// The first request is intercepted with the first response.
echo $client->request('GET', '/')->getStatusCode();
Expand Down Expand Up @@ -68,11 +68,13 @@ history of the requests that were sent by a client.
$container = [];
$history = Middleware::history($container);
$stack = HandlerStack::create();
$handlerStack = HandlerStack::create();
// or $handlerStack = HandlerStack::create($mock); if using the Mock handler.
// Add the history middleware to the handler stack.
$stack->push($history);
$handlerStack->push($history);
$client = new Client(['handler' => $stack]);
$client = new Client(['handler' => $handlerStack]);
$client->request('GET', 'http://httpbin.org/get');
$client->request('HEAD', 'http://httpbin.org/get');
Expand Down

0 comments on commit 9133fe0

Please sign in to comment.