Skip to content

Commit 1f29ae4

Browse files
authored
Merge pull request #29 from kelunik/fix-trace
Don't make any TRACE requests with a request body
2 parents 5f50357 + 6739a4d commit 1f29ae4

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
## UNRELEASED
55

6+
- 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).
7+
68
### Changed
79

810
- Make the test suite PHPUnit 6 compatible

src/HttpBaseTest.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,16 @@ public function requestProvider()
7373

7474
$cartesianProduct = new CartesianProduct($sets);
7575

76-
return $cartesianProduct->compute();
76+
$cases = $cartesianProduct->compute();
77+
78+
// Filter all TRACE requests with a body, as they're not HTTP spec compliant
79+
return array_filter($cases, function ($case) {
80+
if ($case[0] === 'TRACE' && $case[3] !== null) {
81+
return false;
82+
}
83+
84+
return true;
85+
});
7786
}
7887

7988
/**
@@ -262,7 +271,7 @@ protected function assertRequest(
262271
$name = strtoupper(str_replace('-', '_', 'http-'.$name));
263272

264273
$this->assertArrayHasKey($name, $request['SERVER']);
265-
$this->assertSame($value, $request['SERVER'][$name]);
274+
$this->assertSame($value, $request['SERVER'][$name], "Failed asserting value for {$name}.");
266275
}
267276
}
268277

0 commit comments

Comments
 (0)