Skip to content

Commit 1aa078b

Browse files
committed
Quick fix for RequestHandler when used as a middleware.
1 parent 8270c12 commit 1aa078b

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [2.0.1] - 2019-07-15
8+
### Fixed
9+
- When RequestHandler was used as a middleware, default RequestHandler was not saved and wrong default request handler
10+
was called.
11+
712
## [2.0.0] - 2019-07-12
813
### Added
914
- RequestHandler supports MiddlewareInterface to be use as a middleware as well

src/RequestHandler.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ public function handle(ServerRequestInterface $request): ResponseInterface
8686

8787
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
8888
{
89+
if (!isset($this->defaultRequestHandler)) {
90+
$this->defaultRequestHandler = $handler;
91+
}
92+
8993
if ($this->middlewareCollection->isEmpty()) {
9094
return $handler->handle($request);
9195
}

0 commit comments

Comments
 (0)