From 5cd0857e3c87541fa8a628b0623b8959bfba2ca8 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Tue, 22 Nov 2016 10:45:17 +0100 Subject: Return 304 when content isn't reloaded using the API Previously it was a 400 but this is more related to a real error. Using the API user should only know the content got reloaded or not. If reloaded: 200 otherwise: 304. --- src/Wallabag/ApiBundle/Controller/EntryRestController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Wallabag/ApiBundle') diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index 1a726b6e..2c2ec0c1 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php @@ -287,7 +287,7 @@ class EntryRestController extends WallabagRestController /** * Reload an entry. - * A response with HTTP Status 400 will be return if we weren't able to update the content (because it hasn't changed or we got an error). + * An empty response with HTTP Status 304 will be send if we weren't able to update the content (because it hasn't changed or we got an error). * * @ApiDoc( * requirements={ @@ -310,12 +310,12 @@ class EntryRestController extends WallabagRestController 'entry' => $entry, ]); - return new JsonResponse(['error' => 'Error while trying to fetch content'], 400); + return new JsonResponse([], 304); } // if refreshing entry failed, don't save it if ($this->getParameter('wallabag_core.fetching_error_message') === $entry->getContent()) { - return new JsonResponse(['error' => 'Error while trying to extract content'], 400); + return new JsonResponse([], 304); } $em = $this->getDoctrine()->getManager(); -- cgit v1.2.3