Skip to content

Commit

Permalink
Merge pull request #3 from diwms/master
Browse files Browse the repository at this point in the history
Middleware improvement
  • Loading branch information
odan committed Apr 9, 2019
2 parents b7d6f8f + 0bd5b63 commit e2689ed
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Session/SessionMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ public function __construct(SessionInterface $session)
*/
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, $next): ResponseInterface
{
$this->session->start();
if (!$this->session->isStarted()) {
$this->session->start();
}

$response = $next($request, $response);
$this->session->save();

Expand Down

0 comments on commit e2689ed

Please sign in to comment.