Skip to content

Commit 3d362d2

Browse files
Ensure items endpoint is geojson (#488)
* fix: items endpoint is geojson * chore: update changelog Co-authored-by: Jeff Albrecht <geospatialjeff@gmail.com>
1 parent bb53a18 commit 3d362d2

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

CHANGES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
### Fixed
1616

1717
* Fix pgstac backend for /queryables endpoint to return 404 for non-existent collections [#482](https://github.com/stac-utils/stac-fastapi/pull/482)
18-
18+
* /collection/{collection_id}/items endpoints now return geojson media type [#488](https://github.com/stac-utils/stac-fastapi/pull/488)
1919

2020
## [2.4.2]
2121

stac_fastapi/api/stac_fastapi/api/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,12 +273,12 @@ def register_get_item_collection(self):
273273
response_model=ItemCollection
274274
if self.settings.enable_response_models
275275
else None,
276-
response_class=self.response_class,
276+
response_class=GeoJSONResponse,
277277
response_model_exclude_unset=True,
278278
response_model_exclude_none=True,
279279
methods=["GET"],
280280
endpoint=create_async_endpoint(
281-
self.client.item_collection, request_model, self.response_class
281+
self.client.item_collection, request_model, GeoJSONResponse
282282
),
283283
)
284284

stac_fastapi/pgstac/tests/api/test_api.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ async def test_get_queryables_content_type(app_client, load_test_collection):
4343
assert resp.headers["content-type"] == "application/schema+json"
4444

4545

46+
async def test_get_features_content_type(app_client, load_test_collection):
47+
coll = load_test_collection
48+
resp = await app_client.get(f"collections/{coll.id}/items")
49+
assert resp.headers["content-type"] == "application/geo+json"
50+
51+
4652
async def test_api_headers(app_client):
4753
resp = await app_client.get("/api")
4854
assert (

stac_fastapi/sqlalchemy/tests/api/test_api.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,12 @@ def test_app_search_response_duplicate_forwarded_headers(
436436
assert link["href"].startswith("https://testserver:1234/")
437437

438438

439+
async def test_get_features_content_type(app_client, load_test_data):
440+
item = load_test_data("test_item.json")
441+
resp = await app_client.get(f"collections/{item['collection']}/items")
442+
assert resp.headers["content-type"] == "application/geo+json"
443+
444+
439445
def test_item_collection_filter_bbox(load_test_data, app_client, postgres_transactions):
440446
item = load_test_data("test_item.json")
441447
collection = item["collection"]

0 commit comments

Comments
 (0)