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:
@@ -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,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user