Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure items endpoint is geojson #488

Merged
merged 3 commits into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
### Fixed

* Fix pgstac backend for /queryables endpoint to return 404 for non-existent collections [#482](https://github.com/stac-utils/stac-fastapi/pull/482)

* /collection/{collection_id}/items endpoints now return geojson media type [#488](https://github.com/stac-utils/stac-fastapi/pull/488)

## [2.4.2]

Expand Down
4 changes: 2 additions & 2 deletions stac_fastapi/api/stac_fastapi/api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,12 @@ def register_get_item_collection(self):
response_model=ItemCollection
if self.settings.enable_response_models
else None,
response_class=self.response_class,
response_class=GeoJSONResponse,
response_model_exclude_unset=True,
response_model_exclude_none=True,
methods=["GET"],
endpoint=create_async_endpoint(
self.client.item_collection, request_model, self.response_class
self.client.item_collection, request_model, GeoJSONResponse
),
)

Expand Down
6 changes: 6 additions & 0 deletions stac_fastapi/pgstac/tests/api/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ async def test_get_queryables_content_type(app_client, load_test_collection):
assert resp.headers["content-type"] == "application/schema+json"


async def test_get_features_content_type(app_client, load_test_collection):
coll = load_test_collection
resp = await app_client.get(f"collections/{coll.id}/items")
assert resp.headers["content-type"] == "application/geo+json"


async def test_api_headers(app_client):
resp = await app_client.get("/api")
assert (
Expand Down
6 changes: 6 additions & 0 deletions stac_fastapi/sqlalchemy/tests/api/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,12 @@ def test_app_search_response_duplicate_forwarded_headers(
assert link["href"].startswith("https://testserver:1234/")


async def test_get_features_content_type(app_client, load_test_data):
item = load_test_data("test_item.json")
resp = await app_client.get(f"collections/{item['collection']}/items")
assert resp.headers["content-type"] == "application/geo+json"


def test_item_collection_filter_bbox(load_test_data, app_client, postgres_transactions):
item = load_test_data("test_item.json")
collection = item["collection"]
Expand Down