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

More explicit error for removed Query extension #615

Merged
merged 3 commits into from
Jul 8, 2024
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
7 changes: 7 additions & 0 deletions cubedash/_stac.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,13 @@ def _handle_search_request(
"Only 'id', 'collection', and Item properties can be used to sort results.",
)

# Make sure users know that the query extension isn't implemented
if request_args.get("query") is not None:
abort(
400,
"The Query extension is no longer supported. Please use the Filter extension instead.",
)

filter_lang = request_args.get("filter-lang", default=None, type=str)
filter_cql = request_args.get("filter", default=None, type=_filter_arg)
filter_crs = request_args.get("filter-crs", default=None)
Expand Down
19 changes: 19 additions & 0 deletions integration_tests/test_stac.py
Original file line number Diff line number Diff line change
Expand Up @@ -1544,3 +1544,22 @@ def test_stac_filter_extension(stac_client: FlaskClient):
headers={"Content-Type": "application/json", "Accept": "application/json"},
)
assert rv.status_code == 400


def test_stac_query_extension_errors(stac_client: FlaskClient):
# Trying to use query extension should error
query = {"cloud_cover": {"lt": 1}}
rv: Response = stac_client.post(
"/stac/search",
data=json.dumps(
{
"product": "ga_ls8c_ard_3",
"time": "2022-01-01T00:00:00/2022-12-31T00:00:00",
"limit": OUR_DATASET_LIMIT,
"_full": True,
"query": query,
}
),
headers={"Content-Type": "application/json", "Accept": "application/json"},
)
assert rv.status_code == 400
Loading