Skip to content

Commit 7b002de

Browse files
authored
ignore not versioned accept header (#9)
1 parent e403a7a commit 7b002de

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

fast_version/app.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ async def __call__(
5353
break
5454

5555
if media_type.strip() != _get_vendor_media_type():
56-
error_response = JSONResponse(
57-
{"detail": "Wrong media type"},
58-
status_code=406,
59-
)
6056
break
6157

6258
version = ""

tests/test_app.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ async def test_simple_router(test_client: TestClient) -> None:
7373
assert text == "Hello, world!"
7474

7575

76-
async def test_bad_accept_header(test_client: TestClient) -> None:
76+
async def test_bad_accept_header_default_response(test_client: TestClient) -> None:
7777
response = test_client.get(
7878
"/test/",
7979
headers={"Accept": "application/vnd.wrong+json; version=1.0"},
8080
)
81-
assert response.status_code == status.HTTP_406_NOT_ACCEPTABLE
82-
assert response.json() == {"detail": "Wrong media type"}
81+
assert response.status_code == status.HTTP_200_OK
82+
assert response.headers["content-type"] == f"{VERSION_HEADER}; version=1.0"
8383

8484

8585
async def test_no_version(test_client: TestClient) -> None:

0 commit comments

Comments
 (0)