Issue #2971012 by Wim Leers, borisson_: ContentTypeHeaderMatcher should not run for DELETE requests

8.6.x
Alex Pott 2018-05-07 17:16:26 +01:00
parent aeb5733c8a
commit 246a31c42f
No known key found for this signature in database
GPG Key ID: 31905460D4A69276
2 changed files with 5 additions and 4 deletions

View File

@ -15,10 +15,10 @@ class ContentTypeHeaderMatcher implements FilterInterface {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function filter(RouteCollection $collection, Request $request) { public function filter(RouteCollection $collection, Request $request) {
// The Content-type header does not make sense on GET requests, because GET // The Content-type header does not make sense on GET or DELETE requests,
// requests do not carry any content. Nothing to filter in this case. Same // because they do not carry any content. Nothing to filter in this case.
// for all other safe methods. // Same for all other safe methods.
if ($request->isMethodSafe(FALSE)) { if ($request->isMethodSafe(FALSE) || $request->isMethod('DELETE')) {
return $collection; return $collection;
} }

View File

@ -61,6 +61,7 @@ class ContentTypeHeaderMatcherTest extends UnitTestCase {
['HEAD'], ['HEAD'],
['OPTIONS'], ['OPTIONS'],
['TRACE'], ['TRACE'],
['DELETE'],
]; ];
} }