Skip to content

Default response and exception for mock client #212

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

Merged
merged 1 commit into from
Nov 25, 2017

Conversation

soullivaneuh
Copy link
Contributor

Copy link
Contributor

@dbu dbu left a comment

Choose a reason for hiding this comment

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

i think we need to be a bit more explicit here and say in the introduction that you can set a list of responses resp exceptions that are returned in order (exceptions first), and/or default exception / response for when the lists are empty.

(oh, and its kindof odd that we first throw all exceptions and then return responses in the list, rather than strictly keeping the order. i can't test something like exception, response, exception with the mock client. but changing that would be a confusing BC break for tests built on it. but the doc should at least mention it)

@soullivaneuh
Copy link
Contributor Author

@dbu Do you have some code sample to propose?

@dbu
Copy link
Contributor

dbu commented Nov 8, 2017

i think we should have text for that rather than just samples. samples are implicit.

something like "By default, the mock client returns an empty response with status 200. You can set responses and exceptions the mock client should return / throw. You can set several exceptions and responses, to have the client first throw each exception once and then each response once on subsequent calls to send(). Additionally you can set a default response or a default exception to be used instead of the empty response."

@soullivaneuh soullivaneuh force-pushed the default-response-exception branch from 98df558 to 78fccff Compare November 8, 2017 12:14
@soullivaneuh
Copy link
Contributor Author

@dbu updated.

@Nyholm Nyholm merged commit 6fb70d9 into php-http:master Nov 25, 2017
@soullivaneuh soullivaneuh deleted the default-response-exception branch November 30, 2017 15:51
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.

3 participants