Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
a858b347
Commit
a858b347
authored
May 12, 2013
by
Alex Pott
Browse files
Issue
#1983710
by manarth: Fixed HTTP: Use 406 (Not acceptable) over 415 (Unsupported media type).
parent
f630b510
Changes
4
Hide whitespace changes
Inline
Side-by-side
core/lib/Drupal/Core/EventSubscriber/ViewSubscriber.php
View file @
a858b347
...
...
@@ -59,7 +59,7 @@ public function onView(GetResponseForControllerResultEvent $event) {
$event
->
setResponse
(
$this
->
$method
(
$event
));
}
else
{
$event
->
setResponse
(
new
Response
(
'
Unsupported Media Typ
e'
,
4
15
));
$event
->
setResponse
(
new
Response
(
'
Not Acceptabl
e'
,
4
06
));
}
}
elseif
(
$request
->
attributes
->
get
(
'_legacy'
))
{
...
...
core/lib/Drupal/Core/Routing/MimeTypeMatcher.php
View file @
a858b347
...
...
@@ -8,7 +8,7 @@
namespace
Drupal\Core\Routing
;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\HttpKernel\Exception\
UnsupportedMediaTyp
eHttpException
;
use
Symfony\Component\HttpKernel\Exception\
NotAcceptabl
eHttpException
;
use
Symfony\Component\Routing\RouteCollection
;
use
Symfony\Cmf\Component\Routing\NestedMatcher\RouteFilterInterface
;
...
...
@@ -41,7 +41,7 @@ public function filter(RouteCollection $collection, Request $request) {
}
if
(
!
count
(
$filtered_collection
))
{
throw
new
UnsupportedMediaTyp
eHttpException
();
throw
new
NotAcceptabl
eHttpException
();
}
return
$filtered_collection
;
...
...
core/modules/rest/lib/Drupal/rest/Tests/ReadTest.php
View file @
a858b347
...
...
@@ -60,7 +60,7 @@ public function testRead() {
// Try to read the entity with an unsupported mime format.
$response
=
$this
->
httpRequest
(
'entity/'
.
$entity_type
.
'/'
.
$entity
->
id
(),
'GET'
,
NULL
,
'application/wrongformat'
);
$this
->
assertResponse
(
4
15
);
$this
->
assertResponse
(
4
06
);
// Try to read an entity that does not exist.
$response
=
$this
->
httpRequest
(
'entity/'
.
$entity_type
.
'/9999'
,
'GET'
,
NULL
,
$this
->
defaultMimeType
);
...
...
core/modules/system/lib/Drupal/system/Tests/Routing/MimeTypeMatcherTest.php
View file @
a858b347
...
...
@@ -11,7 +11,7 @@
use
Drupal\simpletest\UnitTestBase
;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\HttpKernel\Exception\
UnsupportedMediaTyp
eHttpException
;
use
Symfony\Component\HttpKernel\Exception\
NotAcceptabl
eHttpException
;
/**
* Basic tests for the MimeTypeMatcher class.
...
...
@@ -91,7 +91,7 @@ public function testNoRouteFound() {
$routes
=
$matcher
->
filter
(
$routes
,
$request
);
$this
->
fail
(
t
(
'No exception was thrown.'
));
}
catch
(
UnsupportedMediaTyp
eHttpException
$e
)
{
catch
(
NotAcceptabl
eHttpException
$e
)
{
$this
->
pass
(
'The correct exception was thrown.'
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment