Skip to content

Commit

Permalink
feat: update middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
Luis-Henrique committed May 21, 2024
1 parent 18817cc commit 5cd8859
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fastapi_extras/middlewares/remove_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
if scope["type"] != "http":
return await self.app(scope, receive, send)

scope["path"] = scope["path"].replace(self.path, "", 1)
scope["path"] = scope["path"].replace(self.path, "/", 1)

await self.app(scope, receive, send)
2 changes: 1 addition & 1 deletion tests/middlewares/test_remove_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from fastapi_extras.middlewares.remove_path import RemovePathMiddleware

app = FastAPI()
app.add_middleware(RemovePathMiddleware, path="test")
app.add_middleware(RemovePathMiddleware, path="/test")


@app.get("/foo")
Expand Down

0 comments on commit 5cd8859

Please sign in to comment.