mirror of
https://github.com/guzzle/guzzle.git
synced 2025-02-24 01:53:58 +01:00
Merge pull request #2113 from tarjei/docs-patch-1
Clean up variable naming to make docs a bit clearer
This commit is contained in:
commit
9133fe03c4
@ -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();
|
||||
@ -68,11 +68,13 @@ history of the requests that were sent by a client.
|
||||
$container = [];
|
||||
$history = Middleware::history($container);
|
||||
|
||||
$stack = HandlerStack::create();
|
||||
// Add the history middleware to the handler stack.
|
||||
$stack->push($history);
|
||||
$handlerStack = HandlerStack::create();
|
||||
// or $handlerStack = HandlerStack::create($mock); if using the Mock handler.
|
||||
|
||||
$client = new Client(['handler' => $stack]);
|
||||
// Add the history middleware to the handler stack.
|
||||
$handlerStack->push($history);
|
||||
|
||||
$client = new Client(['handler' => $handlerStack]);
|
||||
|
||||
$client->request('GET', 'http://httpbin.org/get');
|
||||
$client->request('HEAD', 'http://httpbin.org/get');
|
||||
|
Loading…
x
Reference in New Issue
Block a user