Skip to content

Add a recipes/ folder with FastAPI middleware example #5

Description

@jieyao-MilestoneHub

What

Add a recipes/fastapi_middleware.py example showing how to use redact_url_query inside a FastAPI middleware that logs request URLs without leaking secret query params.

Expected outcome

  • New file recipes/fastapi_middleware.py (under 50 lines)
  • Drop-in RedactingLogMiddleware class that:
    • Reads the request URL
    • Passes it through redact_url_query
    • Logs the redacted form before calling await call_next(request)
  • README "Three killer examples" section gets a fourth bullet linking to the recipe
  • No tests required (it's an integration example, not library code)

Why this is good for newcomers

  • Doesn't touch any library internals
  • Pattern is well-defined in FastAPI docs
  • Showcases a real-world use case redactkit users will want to copy-paste

Pointers

  • Source: src/redactkit/url_query.py
  • README example block to mirror: ## Three killer examples

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationgood first issueWell-scoped for newcomers

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions