1
0
mirror of https://github.com/guzzle/guzzle.git synced 2025-01-17 13:28:13 +01:00

Fix syntax errors (#2590)

This fixes some unclosed braces to make the example code valid.
This commit is contained in:
Vladislav Novik 2020-05-23 21:16:01 +03:00 committed by GitHub
parent ffd3c697b1
commit 5132e8a4da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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');