Skip to content

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

Merged
markstory merged 4 commits intogetsentry:masterfrom
TheJacobWalters:master
Jun 6, 2024
Merged

Add feature for allowing the body of a request to be matched Closes #716#717
markstory merged 4 commits intogetsentry:masterfrom
TheJacobWalters:master

Conversation

@TheJacobWalters
Copy link
Contributor

@TheJacobWalters TheJacobWalters commented May 18, 2024

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.

@TheJacobWalters TheJacobWalters changed the title Add feature for allowing the body of a request to be matched Add feature for allowing the body of a request to be matched Closes #716 May 21, 2024
Comment on lines +177 to +178
If set to ``False``, original request may contain additional parameters.request_body
= request.bodyrequest_body = request.body.decode("utf-8").decode("utf-8")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a mistake.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that was, I have removed it now

@markstory
Copy link
Member

Thank you 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants