app: raise an exception on duplicate endpoint registration

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2023-11-26 19:19:09 -05:00
parent b3b60757aa
commit 94989b39dc
No known key found for this signature in database
GPG Key ID: 5A1EB336DFB4C71B
1 changed files with 4 additions and 0 deletions

View File

@ -323,6 +323,10 @@ class MoonrakerApp:
) )
http_path = api_def.http_path http_path = api_def.http_path
if http_path in self.registered_base_handlers: if http_path in self.registered_base_handlers:
if not is_remote:
raise self.server.error(
f"Local endpoint '{endpoint}' already registered"
)
return return
if TransportType.HTTP in transports: if TransportType.HTTP in transports:
logging.info(f"Registering HTTP Endpoint: ({request_types}) {http_path}") logging.info(f"Registering HTTP Endpoint: ({request_types}) {http_path}")