Skip to content

Commit

Permalink
Add return type hint as a test
Browse files Browse the repository at this point in the history
  • Loading branch information
Adham Salama committed Apr 19, 2023
1 parent a8ce1f0 commit 97b86ac
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ def always_reject_middleware(request: Request):


@app.get("/set-cookie")
def set_cookies(request: Request):
# Don't remove the return type hint
# this catches the case where handler function
# has return type hint which throw a validation error
def set_cookies(request: Request) -> JSONResponse:
"""Sets cookies"""
res = JSONResponse(body=request.cookies, headers=[("header1", "value1")])
res.set_cookie("key1", "value1")
Expand Down

0 comments on commit 97b86ac

Please sign in to comment.