@@ -1321,17 +1321,24 @@ def _validate_search_ids_with_ids_no_override(
13211321 }
13221322
13231323 r = requests .get (search_url , params = get_params )
1324- try :
1325- if len (r .json ().get ("features" )) > 0 :
1326- errors .append (
1327- "GET Search with ids and non-intersecting bbox returned results, indicating "
1328- "the ids parameter is overriding the bbox parameter. All parameters are applied equally since "
1329- "STAC API 1.0.0-beta.1"
1330- )
1331- except json .decoder .JSONDecodeError :
1324+
1325+ if not (r .status_code == 200 ):
13321326 errors .append (
1333- f"GET Search with { get_params } returned non-json response: { r .text } "
1327+ f"GET Search with id and other parameters returned status code { r .status_code } "
13341328 )
1329+ else :
1330+
1331+ try :
1332+ if len (r .json ().get ("features" , [])) > 0 :
1333+ errors .append (
1334+ "GET Search with ids and non-intersecting bbox returned results, indicating "
1335+ "the ids parameter is overriding the bbox parameter. All parameters are applied equally since "
1336+ "STAC API 1.0.0-beta.1"
1337+ )
1338+ except json .decoder .JSONDecodeError :
1339+ errors .append (
1340+ f"GET Search with { get_params } returned non-json response: { r .text } "
1341+ )
13351342
13361343 if post :
13371344 post_params = {
@@ -1342,17 +1349,22 @@ def _validate_search_ids_with_ids_no_override(
13421349
13431350 r = requests .post (search_url , json = post_params )
13441351
1345- try :
1346- if len (r .json ().get ("features" )) > 0 :
1347- errors .append (
1348- "POST Search with ids and non-intersecting bbox returned results, indicating "
1349- "the ids parameter is overriding the bbox parameter. All parameters are applied equally since "
1350- "STAC API 1.0.0-beta.1"
1351- )
1352- except json .decoder .JSONDecodeError :
1352+ if not (r .status_code == 200 ):
13531353 errors .append (
1354- f"POST Search with { get_params } returned non-json response: { r .text } "
1354+ f"POST Search with id and other parameters returned status code { r .status_code } "
13551355 )
1356+ else :
1357+ try :
1358+ if len (r .json ().get ("features" , [])) > 0 :
1359+ errors .append (
1360+ "POST Search with ids and non-intersecting bbox returned results, indicating "
1361+ "the ids parameter is overriding the bbox parameter. All parameters are applied equally since "
1362+ "STAC API 1.0.0-beta.1"
1363+ )
1364+ except json .decoder .JSONDecodeError :
1365+ errors .append (
1366+ f"POST Search with { get_params } returned non-json response: { r .text } "
1367+ )
13561368
13571369
13581370def validate_item_search_ids (
0 commit comments