File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
stac_fastapi/core/stac_fastapi/core Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -390,12 +390,14 @@ async def get_search(
390390 HTTPException: If any error occurs while searching the catalog.
391391 """
392392 limit = int (request .query_params .get ("limit" , os .getenv ("STAC_ITEM_LIMIT" , 10 )))
393+ # Support pagination when called from item_collection by reading token from the query string
394+ token_val = token or request .query_params .get ("token" )
393395 base_args = {
394396 "collections" : collections ,
395397 "ids" : ids ,
396398 "bbox" : bbox ,
397399 "limit" : limit ,
398- "token" : token ,
400+ "token" : token_val ,
399401 "query" : orjson .loads (query ) if query else query ,
400402 "q" : q ,
401403 }
@@ -531,10 +533,14 @@ async def post_search(
531533 if search_request .limit :
532534 limit = search_request .limit
533535
536+ # Use token from the request if the model doesn't define it
537+ token_param = getattr (
538+ search_request , "token" , None
539+ ) or request .query_params .get ("token" )
534540 items , maybe_count , next_token = await self .database .execute_search (
535541 search = search ,
536542 limit = limit ,
537- token = getattr ( search_request , "token" , None ) ,
543+ token = token_param ,
538544 sort = sort ,
539545 collection_ids = getattr (search_request , "collections" , None ),
540546 datetime_search = datetime_search ,
You can’t perform that action at this time.
0 commit comments