Skip to content

Use HTTP status constants in API routers#376

Open
silentgeckoaudit3801 wants to merge 9 commits into
Quantarq:mainfrom
silentgeckoaudit3801:refactor/http-status-constants-226
Open

Use HTTP status constants in API routers#376
silentgeckoaudit3801 wants to merge 9 commits into
Quantarq:mainfrom
silentgeckoaudit3801:refactor/http-status-constants-226

Conversation

@silentgeckoaudit3801

Copy link
Copy Markdown

Summary

  • replace API HTTP status literals for 400/401/404/422 with fastapi.status constants
  • cover the touched routers with a static regression test that rejects literal status codes in HTTPException calls

Validation

  • Static API validation found no remaining status_code=400/401/404/422 or positional HTTPException(400/401/404/422, ...) patterns in quantara/web_app/api
  • Static API validation confirmed each touched router imports status
  • Compare is 0 commits behind upstream main

Closes #226

if LITERAL_STATUS_RE.search(text):
offenders.append(str(path))

assert offenders == [] No newline at end of file

import structlog
from fastapi import HTTPException, Request
from fastapi import HTTPException, Request, status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTTP status code constants

2 participants