plugin: nwc: handle missing params dict in request
Even though the NIP-47 specification kind of defines that requests should always pass a params dict in their request i witnessed way too often that clients don't include it in some requests where it is technically not neccessary and we fail on it. Handling this gracefully improves compatibility without obvious downsides.
This commit is contained in:
@@ -344,7 +344,7 @@ class NWCServer(Logger, EventListener):
|
||||
content = json.loads(content)
|
||||
if not isinstance(content, dict):
|
||||
raise Exception("malformed content, not dict")
|
||||
params: dict = content['params']
|
||||
params: dict = content.get('params', {})
|
||||
if not isinstance(params, dict):
|
||||
raise Exception("malformed params, not dict")
|
||||
except Exception:
|
||||
|
||||
Reference in New Issue
Block a user