Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
304
Merge Requests
304
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
a858b347
Commit
a858b347
authored
May 12, 2013
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
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
Showing
4 changed files
with
6 additions
and
6 deletions
+6
-6
core/lib/Drupal/Core/EventSubscriber/ViewSubscriber.php
core/lib/Drupal/Core/EventSubscriber/ViewSubscriber.php
+1
-1
core/lib/Drupal/Core/Routing/MimeTypeMatcher.php
core/lib/Drupal/Core/Routing/MimeTypeMatcher.php
+2
-2
core/modules/rest/lib/Drupal/rest/Tests/ReadTest.php
core/modules/rest/lib/Drupal/rest/Tests/ReadTest.php
+1
-1
core/modules/system/lib/Drupal/system/Tests/Routing/MimeTypeMatcherTest.php
...m/lib/Drupal/system/Tests/Routing/MimeTypeMatcherTest.php
+2
-2
No files found.
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 Type'
,
415
));
$event
->
setResponse
(
new
Response
(
'
Not Acceptable'
,
406
));
}
}
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
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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