Jean-Tiare Le Bigot committed 65f2522

fix #9; When QUERY hash_key is not found, return empty result set instead of prpagating a KeyError

Comments (0)

Files changed (2)


         if start and start['HashKeyElement'] != hash_key:
             raise ValidationException("'HashKeyElement' element of 'ExclusiveStartKey' must be the same as the hash_key. Expected {}, got {}".format(hash_key, start['HashKeyElement']))
-        data =[hash_value, None]
+        try:
+            data =[hash_value, None]
+        except KeyError:
+            # fix #9: return empty result set if first key does not exist
+            return Results(results, size, lek, -1)
         keys = sorted(data.keys())


         # Protocol check
-        res ='/', request, HEADERS, status=400)
+        res ='/', request, HEADERS, status=200)
         self.assertEqual(expected, json.loads(res.body))
         self.assertEqual('application/x-amz-json-1.0; charset=UTF-8', res.headers['Content-Type'])