mirror of
https://github.com/guzzle/guzzle.git
synced 2025-01-17 21:38:16 +01:00
Fix syntax errors (#2590)
This fixes some unclosed braces to make the example code valid.
This commit is contained in:
parent
ffd3c697b1
commit
5132e8a4da
@ -226,17 +226,17 @@ stack.
|
||||
$stack->push(Middleware::mapRequest(function (RequestInterface $r) {
|
||||
echo 'A';
|
||||
return $r;
|
||||
});
|
||||
}));
|
||||
|
||||
$stack->push(Middleware::mapRequest(function (RequestInterface $r) {
|
||||
echo 'B';
|
||||
return $r;
|
||||
});
|
||||
}));
|
||||
|
||||
$stack->push(Middleware::mapRequest(function (RequestInterface $r) {
|
||||
echo 'C';
|
||||
return $r;
|
||||
});
|
||||
}));
|
||||
|
||||
$client->request('GET', 'http://httpbin.org/');
|
||||
// echoes 'ABC';
|
||||
@ -244,7 +244,7 @@ stack.
|
||||
$stack->unshift(Middleware::mapRequest(function (RequestInterface $r) {
|
||||
echo '0';
|
||||
return $r;
|
||||
});
|
||||
}));
|
||||
|
||||
$client = new Client(['handler' => $stack]);
|
||||
$client->request('GET', 'http://httpbin.org/');
|
||||
@ -262,17 +262,17 @@ by name.
|
||||
// Add a middleware with a name
|
||||
$stack->push(Middleware::mapRequest(function (RequestInterface $r) {
|
||||
return $r->withHeader('X-Foo', 'Bar');
|
||||
}, 'add_foo');
|
||||
}, 'add_foo'));
|
||||
|
||||
// Add a middleware before a named middleware (unshift before).
|
||||
$stack->before('add_foo', Middleware::mapRequest(function (RequestInterface $r) {
|
||||
return $r->withHeader('X-Baz', 'Qux');
|
||||
}, 'add_baz');
|
||||
}, 'add_baz'));
|
||||
|
||||
// Add a middleware after a named middleware (pushed after).
|
||||
$stack->after('add_baz', Middleware::mapRequest(function (RequestInterface $r) {
|
||||
return $r->withHeader('X-Lorem', 'Ipsum');
|
||||
});
|
||||
}));
|
||||
|
||||
// Remove a middleware by name
|
||||
$stack->remove('add_foo');
|
||||
|
Loading…
x
Reference in New Issue
Block a user