diff --git a/CHANGELOG.md b/CHANGELOG.md index 2242647..2aa8a7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ ## UNRELEASED +- Don't test `TRACE` requests with request bodies, as they're not valid requests according to the [RFC](https://tools.ietf.org/html/rfc7231#section-4.3.8). + ### Changed - Make the test suite PHPUnit 6 compatible diff --git a/src/HttpBaseTest.php b/src/HttpBaseTest.php index e697528..72bcf62 100644 --- a/src/HttpBaseTest.php +++ b/src/HttpBaseTest.php @@ -73,7 +73,16 @@ public function requestProvider() $cartesianProduct = new CartesianProduct($sets); - return $cartesianProduct->compute(); + $cases = $cartesianProduct->compute(); + + // Filter all TRACE requests with a body, as they're not HTTP spec compliant + return array_filter($cases, function ($case) { + if ($case[0] === 'TRACE' && $case[3] !== null) { + return false; + } + + return true; + }); } /** @@ -262,7 +271,7 @@ protected function assertRequest( $name = strtoupper(str_replace('-', '_', 'http-'.$name)); $this->assertArrayHasKey($name, $request['SERVER']); - $this->assertSame($value, $request['SERVER'][$name]); + $this->assertSame($value, $request['SERVER'][$name], "Failed asserting value for {$name}."); } }