fix: lnurl should follow redirect (#2167)

`r.raise_for_status` raises an proper exception now
This commit is contained in:
dni ⚡
2023-12-11 11:57:36 +01:00
committed by GitHub
parent f9c9c52d75
commit 8352223704

View File

@@ -405,7 +405,7 @@ async def api_payments_pay_lnurl(
domain = urlparse(data.callback).netloc domain = urlparse(data.callback).netloc
headers = {"User-Agent": settings.user_agent} headers = {"User-Agent": settings.user_agent}
async with httpx.AsyncClient(headers=headers) as client: async with httpx.AsyncClient(headers=headers, follow_redirects=True) as client:
try: try:
r = await client.get( r = await client.get(
data.callback, data.callback,
@@ -414,6 +414,7 @@ async def api_payments_pay_lnurl(
) )
if r.is_error: if r.is_error:
raise httpx.ConnectError("LNURL callback connection error") raise httpx.ConnectError("LNURL callback connection error")
r.raise_for_status()
except (httpx.ConnectError, httpx.RequestError): except (httpx.ConnectError, httpx.RequestError):
raise HTTPException( raise HTTPException(
status_code=HTTPStatus.BAD_REQUEST, status_code=HTTPStatus.BAD_REQUEST,