Skip to content

Commit

Permalink
fix: add required links to item collection
Browse files Browse the repository at this point in the history
sqlalchemy
  • Loading branch information
gadomski committed Jan 13, 2023
1 parent 3bff044 commit b69c221
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
18 changes: 17 additions & 1 deletion stac_fastapi/sqlalchemy/stac_fastapi/sqlalchemy/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
{
Expand Down
1 change: 1 addition & 0 deletions stac_fastapi/sqlalchemy/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b69c221

Please sign in to comment.