Skip to content

Commit 3bdfcc7

Browse files
committed
content_type None default.
1 parent 1198000 commit 3bdfcc7

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

stac_fastapi/extensions/tests/test_transaction.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,12 @@ def test_update_item(client: TestClient, item: Item) -> None:
114114

115115
def test_patch_item(client: TestClient) -> None:
116116
response = client.patch(
117-
"/collections/a-collection/items/an-item", content="patch request"
117+
"/collections/a-collection/items/an-item", content='{"patch": true}'
118118
)
119119
assert response.is_success, response.text
120120
assert response.json()["path_collection_id"] == "a-collection"
121121
assert response.json()["path_item_id"] == "an-item"
122-
assert response.json()["patch"] == "patch request"
122+
assert response.json()["patch"] == '{"patch": true}'
123123

124124

125125
def test_delete_item(client: TestClient) -> None:
@@ -145,11 +145,11 @@ def test_update_collection(client: TestClient, collection: Collection) -> None:
145145
def test_patch_collection(client: TestClient) -> None:
146146
response = client.patch(
147147
"/collections/a-collection",
148-
content="patch request",
148+
content='{"patch": true}',
149149
)
150150
assert response.is_success, response.text
151151
assert response.json()["path_collection_id"] == "a-collection"
152-
assert response.json()["patch"] == "patch request"
152+
assert response.json()["patch"] == '{"patch": true}'
153153

154154

155155
def test_delete_collection(client: TestClient, collection: Collection) -> None:

stac_fastapi/types/stac_fastapi/types/core.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
"""Base clients."""
22

33
import abc
4-
from typing import Any, Dict, List, Optional, Union
4+
from typing import Annotated, Any, Dict, List, Optional, Union
55
from urllib.parse import urljoin
66

77
import attr
8-
from fastapi import Request
8+
from fastapi import Header, Request
99
from geojson_pydantic.geometries import Geometry
1010
from stac_pydantic import Collection, Item, ItemCollection
1111
from stac_pydantic.links import Relations
@@ -86,7 +86,7 @@ def patch_item(
8686
collection_id: str,
8787
item_id: str,
8888
patch: Any,
89-
content_type: Optional[str],
89+
content_type: Annotated[Optional[str], Header()] = None,
9090
**kwargs,
9191
) -> Optional[Union[stac.Item, Response]]:
9292
"""Update an item from a collection.
@@ -161,7 +161,7 @@ def patch_collection(
161161
self,
162162
collection_id: str,
163163
patch: Any,
164-
content_type: Optional[str],
164+
content_type: Annotated[Optional[str], Header()] = None,
165165
**kwargs,
166166
) -> Optional[Union[stac.Collection, Response]]:
167167
"""Update a collection.
@@ -243,7 +243,7 @@ async def patch_item(
243243
collection_id: str,
244244
item_id: str,
245245
patch: Any,
246-
content_type: Optional[str],
246+
content_type: Annotated[Optional[str], Header()] = None,
247247
**kwargs,
248248
) -> Optional[Union[stac.Item, Response]]:
249249
"""Update an item from a collection.
@@ -318,7 +318,7 @@ async def patch_collection(
318318
self,
319319
collection_id: str,
320320
patch: Any,
321-
content_type: Optional[str],
321+
content_type: Annotated[Optional[str], Header()] = None,
322322
**kwargs,
323323
) -> Optional[Union[stac.Collection, Response]]:
324324
"""Update a collection.

0 commit comments

Comments
 (0)