Skip to content

Commit

Permalink
Bump fastapi from 0.104.1 to 0.109.1 in /backend (#112)
Browse files Browse the repository at this point in the history
* Bump fastapi from 0.104.1 to 0.109.1 in /backend

Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.104.1 to 0.109.1.
- [Release notes](https://github.com/tiangolo/fastapi/releases)
- [Commits](fastapi/fastapi@0.104.1...0.109.1)

---
updated-dependencies:
- dependency-name: fastapi
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* fix: change error handler factory response type

* fix

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: statefb <[email protected]>
  • Loading branch information
dependabot[bot] and statefb authored Apr 4, 2024
1 parent c4bc082 commit bd788cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 3 additions & 7 deletions backend/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
from fastapi.responses import JSONResponse
from fastapi.security import HTTPAuthorizationCredentials
from pydantic import ValidationError
from starlette.requests import Request
from starlette.responses import Response
from starlette.types import ASGIApp, Message

CORS_ALLOW_ORIGINS = os.environ.get("CORS_ALLOW_ORIGINS", "*")
Expand Down Expand Up @@ -68,7 +70,7 @@
)


def error_handler_factory(status_code: int) -> Callable[[Exception], JSONResponse]:
def error_handler_factory(status_code: int) -> Callable[[Request, Exception], Response]:
def error_handler(_: Request, exc: Exception) -> JSONResponse:
logger.error(exc)
logger.error("".join(traceback.format_tb(exc.__traceback__)))
Expand Down Expand Up @@ -122,12 +124,6 @@ async def add_log_requests(request: Request, call_next: ASGIApp):
body = await request.body()
logger.info(f"Request body: {body.decode('utf-8')[:100]}...")

# Avoid application blocking
# See: https://github.com/tiangolo/fastapi/issues/394
async def receive() -> Message:
return {"type": "http.request", "body": body}

request._receive = receive
response = await call_next(request) # type: ignore

return response
2 changes: 1 addition & 1 deletion backend/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fastapi==0.104.1
fastapi==0.109.1
requests==2.31.0
types-requests==2.31.0
pydantic==2.1.1
Expand Down

0 comments on commit bd788cf

Please sign in to comment.