Reduce duplicate matches - ensures compatibility Responses 0.19.0 (#4914)

This commit is contained in:
Bert Blommers 2022-03-07 18:57:09 -01:00 committed by GitHub
parent 16a3f49004
commit 7001ec60df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,6 +10,10 @@ class CustomRegistry(responses.registries.FirstMatchRegistry):
- CallbackResponses are not discarded after first use - users can mock the same URL as often as they like
"""
def add(self, response):
if response not in self.registered:
super().add(response)
def find(self, request):
all_possibles = responses._default_mock._registry.registered + self.registered
found = []