diff --git a/stac_fastapi/sqlalchemy/stac_fastapi/sqlalchemy/core.py b/stac_fastapi/sqlalchemy/stac_fastapi/sqlalchemy/core.py index 68c96f2de..a0a99d044 100644 --- a/stac_fastapi/sqlalchemy/stac_fastapi/sqlalchemy/core.py +++ b/stac_fastapi/sqlalchemy/stac_fastapi/sqlalchemy/core.py @@ -169,7 +169,23 @@ def item_collection( else None ) - links = [] + links = [ + { + "rel": Relations.self.value, + "type": "application/geo+json", + "href": str(kwargs["request"].url), + }, + { + "rel": Relations.root.value, + "type": "application/json", + "href": str(kwargs["request"].base_url), + }, + { + "rel": Relations.parent.value, + "type": "application/json", + "href": str(kwargs["request"].base_url), + }, + ] if page.next: links.append( { diff --git a/stac_fastapi/sqlalchemy/tests/conftest.py b/stac_fastapi/sqlalchemy/tests/conftest.py index 7abd9150f..86984a12f 100644 --- a/stac_fastapi/sqlalchemy/tests/conftest.py +++ b/stac_fastapi/sqlalchemy/tests/conftest.py @@ -70,6 +70,7 @@ def load_file(filename: str) -> Dict: class MockStarletteRequest: base_url = "http://test-server" + url = "http://test-server/some/endpoint" @pytest.fixture