Skip to content

Use http based promise in emulated trait and specs #42

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 4 commits into from
Sep 1, 2016

Conversation

joelwurtz
Copy link
Member

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Related tickets fixes #34 , replace #35
Documentation /
License MIT

See issue #34 and discussion in #35 also for more information

@@ -12,7 +12,7 @@
],
"require": {
"php": ">=5.4",
"php-http/httplug": "^1.0",
"php-http/httplug": "^1.1.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

^1.1 would be fine here

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it's better, thanks.

@joelwurtz joelwurtz force-pushed the fix/switch-to-http-promise branch from 80d58d6 to 07dc655 Compare August 31, 2016 08:40
@GrahamCampbell
Copy link
Contributor

Ok, so what happens when a non-http exception gets thrown?

@joelwurtz joelwurtz force-pushed the fix/switch-to-http-promise branch from 25debfb to 0cf1adb Compare August 31, 2016 08:44
@Nyholm
Copy link
Member

Nyholm commented Aug 31, 2016

When a non-httplug exception is thrown we abort the plugin chain and the exception bubble up like normal. Only httplug exception will respect the plugin chain.

@GrahamCampbell
Copy link
Contributor

This will break other libraries though.

@sagikazarmark
Copy link
Member

I don't think so. If you used a plugin with rejection callbacks broke your library too. This was a bug IMO, which has been solved. Also, this bug only affects you if you use plugins.

@@ -24,7 +24,7 @@
* @param callable $next Next middleware in the chain, the request is passed as the first argument
* @param callable $first First middleware in the chain, used to to restart a request
*
* @return Promise
* @return Promise Resolves a PSR-7 Response or fails with an Http\Client\Exception (The same as HttpAsyncClient).
Copy link
Member Author

Choose a reason for hiding this comment

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

Is this a BC break ? (For me no, it's more a clarification but i dont know if this interface is already used but other packages than one we have under control ?)

Copy link
Member

Choose a reason for hiding this comment

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

Could we improve this doc block somehow even more?

Maybe describe what the callables will return?

Copy link
Member Author

Choose a reason for hiding this comment

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

Don't we have already this on the documentation ? if so would just add a link with @see

Copy link
Member

Choose a reason for hiding this comment

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

We don't but we should. Write
@see http://php-http.readthedocs.io/en/latest/plugins/introduction.html

FYI: php-http/documentation#149

Copy link
Member

Choose a reason for hiding this comment

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

From my POV, it's not. Http Promises still fullfill the Promise interface.

Copy link
Member

Choose a reason for hiding this comment

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

Add "@see http://docs.php-http.org/en/latest/plugins/build-your-own.html". I've added some lines about exceptions (php-http/documentation#151)

Is this a BC break ?

No, this is not a BC break.

@sagikazarmark
Copy link
Member

I added some explanation here: https://github.com/php-http/httplug/releases/tag/v1.1.0

@joelwurtz joelwurtz force-pushed the fix/switch-to-http-promise branch from 0cf1adb to cabbf75 Compare August 31, 2016 09:56
@Nyholm
Copy link
Member

Nyholm commented Sep 1, 2016

Thank you @joelwurtz.

Is this ready for merge?

@sagikazarmark
Copy link
Member

Please gimme a note when this can be merged and tagged because I would like to do some other things too.

@joelwurtz
Copy link
Member Author

For me all the work is done here, so feel free to merge if it's ok to you (not a fan of merging my own PR in a collaboration project, it feels presumptuous...)

@Nyholm Nyholm merged commit 1e51ff2 into master Sep 1, 2016
@Nyholm Nyholm deleted the fix/switch-to-http-promise branch September 1, 2016 13:55
@Nyholm
Copy link
Member

Nyholm commented Sep 1, 2016

Thank you for this PR. Good work!

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.

Clear exception usage in Plugins
4 participants