fastapi-radar 0.1.1__py3-none-any.whl → 0.1.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of fastapi-radar might be problematic. Click here for more details.

fastapi_radar/api.py CHANGED
@@ -98,7 +98,18 @@ def create_api_router(get_session_context) -> APIRouter:
98
98
  query = session.query(CapturedRequest)
99
99
 
100
100
  if status_code:
101
- query = query.filter(CapturedRequest.status_code == status_code)
101
+ # Handle status code ranges (e.g., 200 for 2xx, 400 for 4xx)
102
+ if status_code in [200, 300, 400, 500]:
103
+ # Filter by status code range
104
+ lower_bound = status_code
105
+ upper_bound = status_code + 100
106
+ query = query.filter(
107
+ CapturedRequest.status_code >= lower_bound,
108
+ CapturedRequest.status_code < upper_bound
109
+ )
110
+ else:
111
+ # Exact status code match
112
+ query = query.filter(CapturedRequest.status_code == status_code)
102
113
  if method:
103
114
  query = query.filter(CapturedRequest.method == method)
104
115
  if search:
@@ -246,7 +257,7 @@ def create_api_router(get_session_context) -> APIRouter:
246
257
 
247
258
  @router.get("/stats", response_model=DashboardStats)
248
259
  async def get_stats(
249
- hours: int = Query(1, ge=1, le=24),
260
+ hours: int = Query(1, ge=1, le=720), # Allow up to 30 days
250
261
  slow_threshold: int = Query(100),
251
262
  session: Session = Depends(get_db),
252
263
  ):