aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-11-22 10:45:17 +0100
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-11-22 10:45:19 +0100
commit5cd0857e3c87541fa8a628b0623b8959bfba2ca8 (patch)
treebac9d0e78d0908fa3c8e4c22900a6d7b2d456735 /src
parent944b8d61752bedd126e1cdaeb3205177e414cf6b (diff)
downloadwallabag-5cd0857e3c87541fa8a628b0623b8959bfba2ca8.tar.gz
wallabag-5cd0857e3c87541fa8a628b0623b8959bfba2ca8.tar.zst
wallabag-5cd0857e3c87541fa8a628b0623b8959bfba2ca8.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/Wallabag/ApiBundle/Controller/EntryRestController.php6
1 files changed, 3 insertions, 3 deletions
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
287 287
288 /** 288 /**
289 * Reload an entry. 289 * Reload an entry.
290 * 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). 290 * 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).
291 * 291 *
292 * @ApiDoc( 292 * @ApiDoc(
293 * requirements={ 293 * requirements={
@@ -310,12 +310,12 @@ class EntryRestController extends WallabagRestController
310 'entry' => $entry, 310 'entry' => $entry,
311 ]); 311 ]);
312 312
313 return new JsonResponse(['error' => 'Error while trying to fetch content'], 400); 313 return new JsonResponse([], 304);
314 } 314 }
315 315
316 // if refreshing entry failed, don't save it 316 // if refreshing entry failed, don't save it
317 if ($this->getParameter('wallabag_core.fetching_error_message') === $entry->getContent()) { 317 if ($this->getParameter('wallabag_core.fetching_error_message') === $entry->getContent()) {
318 return new JsonResponse(['error' => 'Error while trying to extract content'], 400); 318 return new JsonResponse([], 304);
319 } 319 }
320 320
321 $em = $this->getDoctrine()->getManager(); 321 $em = $this->getDoctrine()->getManager();