-
Notifications
You must be signed in to change notification settings - Fork 24
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 http request mocking support #235
base: main
Are you sure you want to change the base?
Conversation
@BrianHenryIE Would love to hear your thoughts on this especially :-) Note:The original suggestion was to store the mocked responses in files and use those, but this can be achieved with this solution just as well. Example: Background:
When I run `cat my/mocked/response.json`
Then save STDOUT as {HTTP_RESPONSE}
Scenario: Mock HTTP request in WP-CLI
Given an empty directory
And an HTTP request to https://api.github.com/repos/wp-cli/wp-cli/releases?per_page=100 with this response:
"""
HTTP/1.1 200
Content-Type: application/json
{HTTP_RESPONSE}
""" I haven't tested that though, but I could add a test for it. |
By the way this has already been successfully tested as part of wp-cli/wp-cli#6037, so I think it's good to go. Appreciate a good review though :) |
Fixes #210
http_request()
util wp-cli#6036 for mocking requests done by the WP-CLIhttp_request()
util