File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed 
stac_fastapi/core/stac_fastapi/core Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -275,8 +275,8 @@ async def all_collections(
275275            if  os .getenv ("STAC_GLOBAL_COLLECTION_MAX_LIMIT" )
276276            else  None 
277277        )
278-         default_limit  =  int (os .getenv ("STAC_DEFAULT_COLLECTION_LIMIT" , 300 ))
279278        query_limit  =  request .query_params .get ("limit" )
279+         default_limit  =  int (os .getenv ("STAC_DEFAULT_COLLECTION_LIMIT" , 300 ))
280280
281281        body_limit  =  None 
282282        try :
@@ -742,14 +742,23 @@ async def post_search(
742742            if  os .getenv ("STAC_GLOBAL_ITEM_MAX_LIMIT" )
743743            else  None 
744744        )
745+         query_limit  =  request .query_params .get ("limit" )
745746        default_limit  =  int (os .getenv ("STAC_DEFAULT_ITEM_LIMIT" , 10 ))
746747
747-         requested_limit  =  getattr (search_request , "limit" , None )
748+         body_limit  =  None 
749+         try :
750+             if  request .method  ==  "POST"  and  request .body ():
751+                 body_data  =  await  request .json ()
752+                 body_limit  =  body_data .get ("limit" )
753+         except  Exception :
754+             pass 
748755
749-         if  requested_limit  is  None :
750-             limit  =  default_limit 
756+         if  body_limit  is  not None :
757+             limit  =  int (body_limit )
758+         elif  query_limit :
759+             limit  =  int (query_limit )
751760        else :
752-             limit  =  requested_limit 
761+             limit  =  default_limit 
753762
754763        if  global_max_limit :
755764            limit  =  min (limit , global_max_limit )
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments