diff --git a/superdesk/core/web/types.py b/superdesk/core/web/types.py index 32b4af72e5..52e081d146 100644 --- a/superdesk/core/web/types.py +++ b/superdesk/core/web/types.py @@ -224,14 +224,14 @@ def endpoint( """ def fdec(func: EndpointFunction): - self.endpoints.append( - Endpoint( - f"{self.url_prefix}/{url}" if self.url_prefix else url, - func, - methods=methods, - name=name, - ) + endpoint_func = Endpoint( + f"{self.url_prefix}/{url}" if self.url_prefix else url, + func, + methods=methods, + name=name, ) + self.endpoints.append(endpoint_func) + return endpoint_func return fdec