Skip to content

Commit 11b94e3

Browse files
committed
fix len miss match.
1 parent 3bcd739 commit 11b94e3

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

stac_fastapi/core/stac_fastapi/core/core.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -737,9 +737,7 @@ async def patch_item(
737737
return ItemSerializer.db_to_stac(item, base_url=base_url)
738738

739739
raise NotImplementedError(
740-
"Content-Type: %s and body: %s combination not implemented",
741-
content_type,
742-
patch,
740+
f"Content-Type: {content_type} and body: {patch} combination not implemented"
743741
)
744742

745743
@overrides
@@ -841,8 +839,8 @@ async def patch_collection(
841839
Returns:
842840
The patched collection.
843841
"""
844-
content_type = kwargs["request"].headers.get("content-type")
845842
base_url = str(kwargs["request"].base_url)
843+
content_type = kwargs["request"].headers.get("content-type")
846844

847845
collection = None
848846
if isinstance(patch, list) and content_type == "application/json-patch+json":
@@ -873,9 +871,7 @@ async def patch_collection(
873871
)
874872

875873
raise NotImplementedError(
876-
"Content-Type: %s and body: %s combination not implemented",
877-
content_type,
878-
patch,
874+
f"Content-Type: {content_type} and body: {patch} combination not implemented"
879875
)
880876

881877
@overrides

stac_fastapi/tests/api/test_api.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,20 @@
5252
async def test_post_search_content_type(app_client, ctx):
5353
params = {"limit": 1}
5454
resp = await app_client.post("/search", json=params)
55-
assert resp.headers["content-type"] == "application/geo+json"
55+
assert resp.headers["Content-Type"] == "application/geo+json"
5656

5757

5858
@pytest.mark.asyncio
5959
async def test_get_search_content_type(app_client, ctx):
6060
resp = await app_client.get("/search")
61-
assert resp.headers["content-type"] == "application/geo+json"
61+
assert resp.headers["Content-Type"] == "application/geo+json"
6262

6363

6464
@pytest.mark.asyncio
6565
async def test_api_headers(app_client):
6666
resp = await app_client.get("/api")
6767
assert (
68-
resp.headers["content-type"] == "application/vnd.oai.openapi+json;version=3.0"
68+
resp.headers["Content-Type"] == "application/vnd.oai.openapi+json;version=3.0"
6969
)
7070
assert resp.status_code == 200
7171

@@ -657,7 +657,7 @@ async def test_patch_operations_collection(app_client, ctx):
657657
resp = await app_client.patch(
658658
f"/collections/{ctx.item['collection']}",
659659
json=operations,
660-
headers={"content-type": "application/json-patch+json"},
660+
headers={"Content-Type": "application/json-patch+json"},
661661
)
662662

663663
assert resp.status_code == 200
@@ -719,7 +719,7 @@ async def test_patch_operations_item(app_client, ctx):
719719
resp = await app_client.patch(
720720
f"/collections/{ctx.item['collection']}/{ctx.item['id']}",
721721
json=operations,
722-
headers={"content-type": "application/json-patch+json"},
722+
headers={"Content-Type": "application/json-patch+json"},
723723
)
724724

725725
assert resp.status_code == 200

stac_fastapi/tests/clients/test_es_os.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ async def test_json_patch_item_add(ctx, core_client, txn_client):
317317
assert updated_item["properties"]["foo"] == "bar"
318318
assert updated_item["properties"]["ext:hello"] == "world"
319319
assert len(updated_item["properties"]["eo:bands"]) == len(
320-
ctx.item["properties"]["eo:bands"] + 1
320+
ctx.item["properties"]["eo:bands"]
321321
)
322322
assert updated_item["properties"]["eo:bands"][1] == {
323323
"gsd": 10,

0 commit comments

Comments
 (0)