Skip to content

Commit a6a5765

Browse files
BUGFIX: invalid landing page link when filter-extension is enabled (#695)
* add test demonstrating bug * fix
1 parent d2fd4a6 commit a6a5765

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

stac_fastapi/api/tests/test_app.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ def test_client_openapi(TestCoreClient):
110110
assert component in test_app.app.openapi_schema["components"]["schemas"]
111111

112112

113-
def test_filter_extension(TestCoreClient, item_dict):
113+
@pytest.mark.parametrize("validate", [True, False])
114+
def test_filter_extension(validate, TestCoreClient, item_dict):
114115
"""Test if Filter Parameters are passed correctly."""
115116

116117
class FilterClient(TestCoreClient):
@@ -159,13 +160,15 @@ def get_search(
159160
post_request_model = create_post_request_model([FilterExtension()])
160161

161162
test_app = app.StacApi(
162-
settings=ApiSettings(),
163+
settings=ApiSettings(enable_response_models=validate),
163164
client=FilterClient(post_request_model=post_request_model),
164165
search_get_request_model=create_get_request_model([FilterExtension()]),
165166
search_post_request_model=post_request_model,
167+
extensions=[FilterExtension()],
166168
)
167169

168170
with TestClient(test_app.app) as client:
171+
landing = client.get("/")
169172
get_search = client.get(
170173
"/search",
171174
params={
@@ -184,5 +187,6 @@ def get_search(
184187
},
185188
)
186189

190+
assert landing.status_code == 200, landing.text
187191
assert get_search.status_code == 200, get_search.text
188192
assert post_search.status_code == 200, post_search.text

stac_fastapi/types/stac_fastapi/types/core.py

-1
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,6 @@ def landing_page(self, **kwargs) -> stac.LandingPage:
384384
"type": MimeTypes.jsonschema.value,
385385
"title": "Queryables",
386386
"href": urljoin(base_url, "queryables"),
387-
"method": "GET",
388387
}
389388
)
390389

0 commit comments

Comments
 (0)