getsentry / responses

A utility for mocking out the Python Requests library.
Apache License 2.0
4.08k stars 347 forks source link

Add feature for allowing the body of a request to be matched Closes #716 #717

Closed TheJacobWalters closed 1 month ago

TheJacobWalters commented 1 month ago

I use responses to mock APIs for applications. One of the API's used by my organization is an API for getting identifying information about about the "Owners" of AWS accounts. And the API just takes in the account number as the body of a GET request.

here is an example of how I query the API from the command line

curl api.company.com/v1/accounts --data 12345

I have not been able to use responses to mock this API because this data is not JSON. I would like to contribute back a more flexible matcher for the bodies that just lets you match anything sent to an API endpoint.

markstory commented 1 month ago

Thank you 🎉