Skip to content

Commit

Permalink
Quick fix for RequestHandler when used as a middleware.
Browse files Browse the repository at this point in the history
  • Loading branch information
noglitchyo committed Jul 15, 2019
1 parent 8270c12 commit 1aa078b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.0.1] - 2019-07-15
### Fixed
- When RequestHandler was used as a middleware, default RequestHandler was not saved and wrong default request handler
was called.

## [2.0.0] - 2019-07-12
### Added
- RequestHandler supports MiddlewareInterface to be use as a middleware as well
Expand Down
4 changes: 4 additions & 0 deletions src/RequestHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ public function handle(ServerRequestInterface $request): ResponseInterface

public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
if (!isset($this->defaultRequestHandler)) {
$this->defaultRequestHandler = $handler;
}

if ($this->middlewareCollection->isEmpty()) {
return $handler->handle($request);
}
Expand Down

0 comments on commit 1aa078b

Please sign in to comment.