mirror of
https://github.com/lnbits/lnbits.git
synced 2025-06-05 12:41:21 +02:00
fix: lnurl should follow redirect (#2167)
`r.raise_for_status` raises an proper exception now
This commit is contained in:
parent
f9c9c52d75
commit
8352223704
@ -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,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user