Support EDR single item locations for Starlette (#1827)

* Support EDR single item locations for starlette

* Model behavior after flask app handler
This commit is contained in:
Benjamin Webb
2024-11-18 12:12:22 -05:00
committed by GitHub
parent a3b42ba0ed
commit 183caacff4
+9 -3
View File
@@ -511,12 +511,13 @@ async def get_job_result_resource(request: Request,
api_.get_job_result_resource, request, job_id, resource)
async def get_collection_edr_query(request: Request, collection_id=None, instance_id=None): # noqa
async def get_collection_edr_query(request: Request, collection_id=None, instance_id=None, location_id=None): # noqa
"""
OGC EDR API endpoints
:param collection_id: collection identifier
:param instance_id: instance identifier
:param location_id: location id of a /locations/<location_id> query
:returns: HTTP response
"""
@@ -527,10 +528,15 @@ async def get_collection_edr_query(request: Request, collection_id=None, instanc
if 'instance_id' in request.path_params:
instance_id = request.path_params['instance_id']
query_type = request["path"].split('/')[-1] # noqa
if 'location_id' in request.path_params:
location_id = request.path_params['location_id']
query_type = 'locations'
else:
query_type = request['path'].split('/')[-1]
return await execute_from_starlette(
edr_api.get_collection_edr_query, request, collection_id,
instance_id, query_type,
instance_id, query_type, location_id,
skip_valid_check=True,
)