File tree Expand file tree Collapse file tree 1 file changed +23
-12
lines changed
stac_fastapi/core/stac_fastapi/core Expand file tree Collapse file tree 1 file changed +23
-12
lines changed Original file line number Diff line number Diff line change @@ -672,7 +672,11 @@ async def post_search(
672672 links = await PagingLinks (request = request , next = next_token ).get_links ()
673673
674674 collection_links = []
675- if items and search_request .collections and len (search_request .collections ) == 1 :
675+ if (
676+ items
677+ and search_request .collections
678+ and len (search_request .collections ) == 1
679+ ):
676680 collection_id = search_request .collections [0 ]
677681 collection_links .extend (
678682 [
@@ -697,22 +701,29 @@ async def post_search(
697701 prev_link = await get_prev_link (redis , token_param )
698702 if prev_link :
699703 method = "GET"
704+ body = None
700705 for link in links :
701- if link .get ("rel" ) == "next" and "method" in link :
702- method = link ["method" ]
706+ if link .get ("rel" ) == "next" :
707+ if "method" in link :
708+ method = link ["method" ]
709+ if "body" in link :
710+ body = {** link ["body" ]}
711+ body .pop ("token" , None )
703712 break
704713 else :
705714 method = request .method
706715
707- links .insert (
708- 0 ,
709- {
710- "rel" : "previous" ,
711- "type" : "application/json" ,
712- "method" : method ,
713- "href" : prev_link ,
714- },
715- )
716+ prev_link_data = {
717+ "rel" : "previous" ,
718+ "type" : "application/json" ,
719+ "method" : method ,
720+ "href" : prev_link ,
721+ }
722+
723+ if body :
724+ prev_link_data ["body" ] = body
725+
726+ links .insert (0 , prev_link_data )
716727
717728 return stac_types .ItemCollection (
718729 type = "FeatureCollection" ,
You can’t perform that action at this time.
0 commit comments