Skip to content

Add Client::getLastRequest #23

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
Jan 4, 2018
Merged

Conversation

soullivaneuh
Copy link
Contributor

@soullivaneuh soullivaneuh commented Nov 8, 2017

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Related tickets fixes #16
Documentation php-http/documentation#213
License MIT

What's in this PR?

Add getters for last response, exception and request.

Why?

Because @sagikazarmark asked for it. 😉

Example Usage

See the doc PR

Checklist

  • Updated CHANGELOG.md to describe BC breaks / deprecations | new feature | bugfix
  • Documentation pull request created (if not simply a bugfix)

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 like the getLastRequest method. the others seem odd - they would return things that we set with addResponse or addException. i don't think we should have those methods. or is there a good use case for them?

@soullivaneuh
Copy link
Contributor Author

or is there a good use case for them?

Well, not for me personally. Maybe @sagikazarmark cans explain it?

@sagikazarmark
Copy link
Member

Because @sagikazarmark asked for it. 😉

I would like to....... 😝

Jokes aside: I can't recall the exact use case for those two (maybe I could have written a better issue description).

I can think of a case when you configure the MockClient outside of your test case (with some common input) and you can't access that input directly. In those cases these methods could be useful, not sure how valid this case is.

@soullivaneuh
Copy link
Contributor Author

I can think of a case when you configure the MockClient outside of your test case

Maybe as a Symfony service for example? php-http/HttplugBundle#212

@soullivaneuh
Copy link
Contributor Author

Conflicts resolved.

@sagikazarmark
Copy link
Member

Hm, maybe. Can't decide whether it's good or bad, but I can't see any issues with having them. @dbu ?

@dbu
Copy link
Contributor

dbu commented Nov 12, 2017

i find them confusing because i don't see legit use cases for it. they can be added when somebody has an actual use case for them imho.

but i can life with them if you insist on having them ;-)

@sagikazarmark
Copy link
Member

i like the getLastRequest method

Do you still think this is useful? Or should we just drop this (BTW sorry @soullivaneuh )

@dbu
Copy link
Contributor

dbu commented Nov 12, 2017

getlastrequest sounds more useful to me. you can check what the last request that has been sent contained, and make assertions on it and so on.

@soullivaneuh
Copy link
Contributor Author

soullivaneuh commented Nov 13, 2017

So do you want me to let only getLastRequest on this PR?

(BTW sorry @soullivaneuh )

Don't worry, not a big deal! 😉

@soullivaneuh soullivaneuh changed the title Last elements getters Add Client::getLastRequest Nov 30, 2017
@soullivaneuh
Copy link
Contributor Author

I updated this PR.

Well, it looks @Nyholm merge the docs one too quickly, here is a correction: php-http/documentation#216

@dbu dbu merged commit 51322eb into php-http:master Jan 4, 2018
@dbu
Copy link
Contributor

dbu commented Jan 4, 2018

sorry, this went under... @soullivaneuh would you mind checking if the doc is now correct on this one as its merged?

@soullivaneuh soullivaneuh deleted the last-elements branch January 7, 2018 12:23
@soullivaneuh
Copy link
Contributor Author

@dbu The doc is good according to me.

Could we have a new release since all the PR are merged? :-)

@Nyholm
Copy link
Member

Nyholm commented Jan 7, 2018

I've reviewed the changes. I think it's alright to tag 1.1.0.

I have not been a part of the latest PRs so I leave it to other maintainer to do the tag.

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.

Add getLastRequest and getLastResponse/Exception methods
5 participants