faster_sam.middlewares package¶
Submodules¶
faster_sam.middlewares.remove_path module¶
- class faster_sam.middlewares.remove_path.RemovePathMiddleware(
- app,
- path,
Bases:
objectRemoves a specified part of the request path.
e.g
This example apply the middleware to transform the request path from “/foo/bar” to “/bar” by removing a specified part (“/foo”).
>>> app = FastAPI() >>> app.add_middleware(RemovePathMiddleware, path="/foo") >>> @app.get("/bar") ... def bar(): ... return {"message": "Responding to GET /foo/bar}
- Parameters:
app (ASGIApp) – Application instance the middleware is being registered to.
path (str) – The part of the path to be removed from incoming requests.