chore: use HTTPStatus for ip middleware (#2792)
This commit is contained in:
parent
4b63d0924e
commit
f5f43e7668
1 changed files with 2 additions and 2 deletions
|
|
@ -230,7 +230,7 @@ def add_ip_block_middleware(app: FastAPI):
|
|||
async def block_allow_ip_middleware(request: Request, call_next):
|
||||
if not request.client:
|
||||
return JSONResponse(
|
||||
status_code=403, # Forbidden
|
||||
status_code=HTTPStatus.FORBIDDEN,
|
||||
content={"detail": "No request client"},
|
||||
)
|
||||
if (
|
||||
|
|
@ -238,7 +238,7 @@ def add_ip_block_middleware(app: FastAPI):
|
|||
and request.client.host not in settings.lnbits_allowed_ips
|
||||
):
|
||||
return JSONResponse(
|
||||
status_code=403, # Forbidden
|
||||
status_code=HTTPStatus.FORBIDDEN,
|
||||
content={"detail": "IP is blocked"},
|
||||
)
|
||||
return await call_next(request)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue