Skip to content

Commit

Permalink
Allow Diactoros 1.3 or 2.0 (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
Firehed authored Oct 24, 2018
1 parent a502c13 commit 2f0a045
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## [3.2.1] - 2018-10-24
### Summary
- Widen range of supported Zend Diactoros version

## [3.2.0] - 2018-09-19
### Summary
- Added support for `PATCH` HTTP method
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"psr/http-server-handler": "^1.0",
"psr/http-server-middleware": "^1.0",
"psr/log": "^1.0",
"zendframework/zend-diactoros": "^1.3"
"zendframework/zend-diactoros": "^1.3 || ^2.0"
},
"suggest": {
"firehed/inputobjects": "Pre-made Input components for validation"
Expand Down
2 changes: 2 additions & 0 deletions src/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ private function transformRequestToServerRequest(RequestInterface $request): Ser
foreach ($request->getHeaders() as $name => $values) {
$serverRequest = $serverRequest->withHeader($name, $values);
}
// ZD2 hints the return type of withHeader to MessageInterface not SRI
assert($serverRequest instanceof ServerRequestInterface);
return $serverRequest;
}

Expand Down
1 change: 1 addition & 0 deletions tests/DispatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public function testSetRequestReturnsSelf()
{
$d = new Dispatcher();
$req = $this->createMock(RequestInterface::class);
$req->method('getMethod')->willReturn('GET');
$req->method('getHeaders')->willReturn([]);
$req->method('getBody')->willReturn($this->createMock(StreamInterface::class));
$req->method('getUri')->willReturn($this->createMock(UriInterface::class));
Expand Down

0 comments on commit 2f0a045

Please sign in to comment.