Skip to content

Commit

Permalink
Bump starlette from 0.19.1 to 0.20.4
Browse files Browse the repository at this point in the history
  • Loading branch information
SogoKato committed Sep 7, 2022
1 parent 3079ba9 commit 2b1f793
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion fastapi/applications.py
Expand Up @@ -33,9 +33,10 @@
from fastapi.utils import generate_unique_id
from starlette.applications import Starlette
from starlette.datastructures import State
from starlette.exceptions import ExceptionMiddleware, HTTPException
from starlette.exceptions import HTTPException
from starlette.middleware import Middleware
from starlette.middleware.errors import ServerErrorMiddleware
from starlette.middleware.exceptions import ExceptionMiddleware
from starlette.requests import Request
from starlette.responses import HTMLResponse, JSONResponse, Response
from starlette.routing import BaseRoute
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Expand Up @@ -35,7 +35,7 @@ classifiers = [
"Topic :: Internet :: WWW/HTTP",
]
requires = [
"starlette==0.19.1",
"starlette==0.20.4",
"pydantic >=1.6.2,!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0",
]
description-file = "README.md"
Expand Down
12 changes: 12 additions & 0 deletions tests/test_route_scope.py
Expand Up @@ -12,6 +12,12 @@ async def get_user(user_id: str, request: Request):
return {"user_id": user_id, "path": route.path}


@app.post("/items/{item_id}:move")
async def move_item(item_id: str, request: Request):
route: APIRoute = request.scope["route"]
return {"item_id": item_id, "path": route.path}


@app.websocket("/items/{item_id}")
async def websocket_item(item_id: str, websocket: WebSocket):
route: APIWebSocketRoute = websocket.scope["route"]
Expand All @@ -38,6 +44,12 @@ def test_invalid_path_doesnt_match():
assert response.status_code == 404, response.text


def test_move():
response = client.post("/items/portal-gun:move")
assert response.status_code == 200, response.text
assert response.json() == {"item_id": "portal-gun", "path": "/items/{item_id}:move"}


def test_websocket():
with client.websocket_connect("/items/portal-gun") as websocket:
data = websocket.receive_json()
Expand Down

0 comments on commit 2b1f793

Please sign in to comment.