Skip to content
Open
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: 1 addition & 1 deletion plugins/restful/RestfulEntityBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -1162,7 +1162,7 @@ protected function isValidEntity($op, $entity_id) {
);

if (!$entity = entity_load_single($entity_type, $entity_id)) {
throw new RestfulUnprocessableEntityException(format_string('The entity ID @id for @resource does not exist.', $params));
throw new RestfulNotFoundException(format_string('The entity ID @id for @resource does not exist.', $params));
}

list(,, $bundle) = entity_extract_ids($entity_type, $entity);
Expand Down
2 changes: 1 addition & 1 deletion tests/RestfulExceptionHandleTestCase.test
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class RestfulExceptionHandleTestCase extends RestfulCurlBaseTestCase {
$url = 'api/v1.0/articles/1';
$result = $this->httpRequest($url);
$body = drupal_json_decode($result['body']);
$this->assertEqual($result['code'], '422', format_string('422 status code sent for @url url.', array('@url' => $url)));
$this->assertEqual($result['code'], '404', format_string('404 status code sent for @url url.', array('@url' => $url)));
$this->assertTrue(strpos($result['headers'], 'application/problem+json;'), '"application/problem+json" found in invalid request.');
$this->assertEqual($body['title'], 'The entity ID 1 for Articles does not exist.', 'Correct error message.');
}
Expand Down