Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Jun 6, 2024

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 markstory merged commit 19efe5b into getsentry:master Jun 6, 2024
13 of 14 checks passed
@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