From 2a4314ca8490dfbc936790d3c95a22213686b73e Mon Sep 17 00:00:00 2001 From: Stefan Stammberger Date: Tue, 28 Sep 2021 21:13:04 +0200 Subject: [PATCH] fix: raise bad req error on call without X-API-key --- lnbits/decorators.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lnbits/decorators.py b/lnbits/decorators.py index ff42d0fd..440f8fa1 100644 --- a/lnbits/decorators.py +++ b/lnbits/decorators.py @@ -96,6 +96,8 @@ async def get_key_type(r: Request, await checker.__call__(r) return WalletTypeInfo(0, checker.wallet) except HTTPException as e: + if e.status_code == HTTPStatus.BAD_REQUEST: + raise if e.status_code == HTTPStatus.UNAUTHORIZED: pass except: @@ -106,6 +108,8 @@ async def get_key_type(r: Request, await checker.__call__(r) return WalletTypeInfo(1, checker.wallet) except HTTPException as e: + if e.status_code == HTTPStatus.BAD_REQUEST: + raise if e.status_code == HTTPStatus.UNAUTHORIZED: return WalletTypeInfo(2, None) except: