Skip to content

Commit

Permalink
Use unshift instead of push in README.md
Browse files Browse the repository at this point in the history
Cookies with `HandlerStack::create()` don't work if the middlewares are in wrong order
  • Loading branch information
valtzu committed Dec 26, 2024
1 parent 9787733 commit 548f97f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Guzzle's `synchronous` option is used to configure the stream blocking option.

```php
$handlerStack = new HandlerStack(new StreamHandler());
$handlerStack->push(new WebSocketMiddleware());
$handlerStack->unshift(new WebSocketMiddleware());

$guzzle = new Client(['handler' => $handlerStack]);

Expand All @@ -31,7 +31,7 @@ $helloWorld = $ws->read(); // This will block until the reply frame is received

```php
$handlerStack = new HandlerStack(new StreamHandler());
$handlerStack->push(new WebSocketMiddleware());
$handlerStack->unshift(new WebSocketMiddleware());

$guzzle = new Client(['handler' => $handlerStack]);

Expand All @@ -58,4 +58,3 @@ $ws->ping();

1. If you have an issue with package, or you have a feature request, please open an issue
1. If you want to contribute code, you may submit a Pull Request. Just remember to add tests.

0 comments on commit 548f97f

Please sign in to comment.