Skip to content
This repository was archived by the owner on Jan 21, 2020. It is now read-only.

Commit 759c2f9

Browse files
committed
Merge branch 'hotfix/implicit-methods-testing' into release-3.0.0
Close #40
2 parents 99eb0a5 + fff7e95 commit 759c2f9

File tree

5 files changed

+128
-21
lines changed

5 files changed

+128
-21
lines changed

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,32 @@
22

33
All notable changes to this project will be documented in this file, in reverse chronological order by release.
44

5+
## 3.0.0rc2 - 2018-03-06
6+
7+
### Added
8+
9+
- Nothing.
10+
11+
### Changed
12+
13+
- [#40](https://github.com/zendframework/zend-expressive-zendrouter/pull/40)
14+
updates the minimum supported version of zend-expressive-router to 3.0.0rc2.
15+
16+
### Deprecated
17+
18+
- Nothing.
19+
20+
### Removed
21+
22+
- Nothing.
23+
24+
### Fixed
25+
26+
- [#40](https://github.com/zendframework/zend-expressive-zendrouter/pull/40)
27+
fixes how the router creates a `RouteResult` when the path matches, but not
28+
the HTTP method. In particular, it does not provide special handling for
29+
`HEAD` requests, treating them like any other method mismatch.
30+
531
## 3.0.0rc1 - 2018-03-05
632

733
### Added

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,16 @@
2323
"php": "^7.1",
2424
"fig/http-message-util": "^1.1.2",
2525
"psr/http-message": "^1.0.1",
26-
"zendframework/zend-expressive-router": "^3.0.0rc1",
26+
"zendframework/zend-expressive-router": "^3.0.0rc2",
2727
"zendframework/zend-psr7bridge": "^0.2.2 || ^1.0.0",
2828
"zendframework/zend-router": "^3.0.2"
2929
},
3030
"require-dev": {
3131
"malukenho/docheader": "^0.1.6",
3232
"phpunit/phpunit": "^7.0.2",
3333
"zendframework/zend-coding-standard": "~1.0.0",
34-
"zendframework/zend-i18n": "^2.7.4"
34+
"zendframework/zend-i18n": "^2.7.4",
35+
"zendframework/zend-stratigility": "^3.0.0rc1"
3536
},
3637
"autoload": {
3738
"psr-4": {

composer.lock

Lines changed: 83 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ZendRouter.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,6 @@ public function match(PsrRequest $request) : RouteResult
9696

9797
$zendRequest = Psr7ServerRequest::toZend($request, true);
9898
$match = $this->zendRouter->match($zendRequest);
99-
if ($request->getMethod() === RequestMethod::METHOD_HEAD
100-
&& (null === $match || null !== $match->getParam(self::METHOD_NOT_ALLOWED_ROUTE))
101-
) {
102-
$match = $this->zendRouter->match($zendRequest->setMethod(RequestMethod::METHOD_GET));
103-
}
10499

105100
if (null === $match) {
106101
// No route matched at all; to indicate that it's not due to the

test/ImplicitMethodsIntegrationTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace ZendTest\Expressive\Router;
1111

12+
use Generator;
1213
use Zend\Expressive\Router\RouterInterface;
1314
use Zend\Expressive\Router\Test\ImplicitMethodsIntegrationTest as RouterIntegrationTest;
1415
use Zend\Expressive\Router\ZendRouter;
@@ -19,4 +20,19 @@ public function getRouter() : RouterInterface
1920
{
2021
return new ZendRouter();
2122
}
23+
24+
public function implicitRoutesAndRequests() : Generator
25+
{
26+
$options = [
27+
'constraints' => [
28+
'version' => '\d+',
29+
],
30+
];
31+
32+
// @codingStandardsIgnoreStart
33+
// route route options, request params
34+
yield 'static' => ['/api/v1/me', $options, '/api/v1/me', []];
35+
yield 'dynamic' => ['/api/v:version/me', $options, '/api/v3/me', ['version' => '3']];
36+
// @codingStandardsIgnoreEnd
37+
}
2238
}

0 commit comments

Comments
 (0)