Commit 64332fe8 authored by alexpott's avatar alexpott
Browse files

Issue #2372011 by richardcanoe, Noe_: NotFoundHttpException handler should...

Issue #2372011 by richardcanoe, Noe_: NotFoundHttpException handler should take into account it's parameters
parent 47e418fe
......@@ -39,7 +39,7 @@ protected static function getPriority() {
* The event to process.
*/
public function on403(GetResponseForExceptionEvent $event) {
$response = new JsonResponse(NULL, Response::HTTP_FORBIDDEN);
$response = new JsonResponse(array('message' => $event->getException()->getMessage()), Response::HTTP_FORBIDDEN);
$event->setResponse($response);
}
......@@ -50,7 +50,7 @@ public function on403(GetResponseForExceptionEvent $event) {
* The event to process.
*/
public function on404(GetResponseForExceptionEvent $event) {
$response = new JsonResponse(NULL, Response::HTTP_NOT_FOUND);
$response = new JsonResponse(array('message' => $event->getException()->getMessage()), Response::HTTP_NOT_FOUND);
$event->setResponse($response);
}
......@@ -61,7 +61,7 @@ public function on404(GetResponseForExceptionEvent $event) {
* The event to process.
*/
public function on405(GetResponseForExceptionEvent $event) {
$response = new JsonResponse(NULL, Response::HTTP_METHOD_NOT_ALLOWED);
$response = new JsonResponse(array('message' => $event->getException()->getMessage()), Response::HTTP_METHOD_NOT_ALLOWED);
$event->setResponse($response);
}
......
......@@ -98,7 +98,7 @@ public function testUserWithoutPermission() {
// Retrieving the metadata should result in an empty 403 response.
$post = array('fields[0]' => 'node/1/body/en/full');
$response = $this->drupalPost('quickedit/metadata', 'application/json', $post);
$this->assertIdentical('{}', $response);
$this->assertIdentical('{"message":""}', $response);
$this->assertResponse(403);
// Quick Edit's JavaScript would SearchRankingTestnever hit these endpoints if the metadata
......@@ -125,7 +125,7 @@ public function testUserWithoutPermission() {
$this->assertResponse(403);
$post = array('nocssjs' => 'true');
$response = $this->drupalPost('quickedit/entity/' . 'node/1', 'application/json', $post);
$this->assertIdentical('{}', $response);
$this->assertIdentical('{"message":""}', $response);
$this->assertResponse(403);
}
......
......@@ -48,7 +48,7 @@ public function testJson403() {
$this->assertEqual($response->getStatusCode(), Response::HTTP_FORBIDDEN);
$this->assertEqual($response->headers->get('Content-type'), 'application/json');
$this->assertEqual('{}', $response->getContent());
$this->assertEqual('{"message":""}', $response->getContent());
}
/**
......@@ -65,7 +65,7 @@ public function testJson404() {
$this->assertEqual($response->getStatusCode(), Response::HTTP_NOT_FOUND);
$this->assertEqual($response->headers->get('Content-type'), 'application/json');
$this->assertEqual('{}', $response->getContent());
$this->assertEqual('{"message":"No route found for \\u0022GET \\/not-found\\u0022"}', $response->getContent());
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment