From e3bdca4973d52fb766db7c71768d5bf21e308b09 Mon Sep 17 00:00:00 2001 From: JustineFricou Date: Mon, 13 May 2024 15:51:53 +0200 Subject: [PATCH] Replaces status 204 by status 400 when no path can be found --- geotrek/core/views.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/geotrek/core/views.py b/geotrek/core/views.py index 1142173040..0a114ee3e9 100644 --- a/geotrek/core/views.py +++ b/geotrek/core/views.py @@ -327,8 +327,11 @@ def route_geometry(self, request, *args, **kwargs): try: path_router = PathRouter() response = path_router.get_route(steps) - status = 200 if response is not None else 204 - + if response is not None: + status = 200 + else: + response = {'error': 'No path between the given points'} + status = 400 except Exception as exc: response, status = {'error': '%s' % exc, }, 500 return Response(response, status)