I would like to match the expected format of a request-signature, without necessarily knowing the exact signature hash. To enable this or similar use cases, it would be nice to be able to supply compiled regex for the matchers.header_matcher similar as it is possible for the url.
In general, this could be a nice feature for all other matchers as well.
Example:
If I want to for example test that an outgoing request to an external API is supplied with a valid signature and a Bearer token. Currently, I'd implement a custom matcher for this. But it would be nice to test header fields optionally with regex directly in the header_matcher.
responses.get(
url,
status=200,
json=mock_data,
match=[
matchers.header_matcher(
{
"Message-Signature": re.compile(r'signature="\S+",created=\d+'),
"Authorization": "Bearer API_TOKEN",
},
strict_match=False
),
signature_matcher,
],
)
Ps: I love responses, thanks for the great work :)
I would like to match the expected format of a request-signature, without necessarily knowing the exact signature hash. To enable this or similar use cases, it would be nice to be able to supply compiled regex for the
matchers.header_matchersimilar as it is possible for the url.In general, this could be a nice feature for all other matchers as well.
Example:
If I want to for example test that an outgoing request to an external API is supplied with a valid signature and a Bearer token. Currently, I'd implement a custom matcher for this. But it would be nice to test header fields optionally with regex directly in the
header_matcher.Ps: I love
responses, thanks for the great work :)