Skip to content

Don't make any TRACE requests with a request body #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 11 additions & 2 deletions src/HttpBaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
}

/**
Expand Down Expand Up @@ -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}.");
}
}

Expand Down