Skip to content

Add request conditional plugin #65

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

Closed
wants to merge 1 commit into from
Closed

Conversation

sagikazarmark
Copy link
Member

Use case: cache certain responses based on a request condition.

Applied fixes from StyleCI
* @param RequestMatcher $requestMatcher
* @param Plugin $delegatedPlugin
*/
public function __construct(RequestMatcher $requestMatcher, Plugin $delegatedPlugin)
Copy link
Member

Choose a reason for hiding this comment

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

I maybe want to use more than one plugin. I suggest allowing the second parameter to be an array of Plugins. Would that be possible?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was also thinking about that. For that case I would add a separate
ChainPlugin.

Tobias Nyholm [email protected] ezt írta (2016. március 5.,
szombat):

In src/RequestConditionalPlugin.php
#65 (comment):

+{

  • /**
  • \* @var RequestMatcher
    
  • */
    
  • private $requestMatcher;
  • /**
  • \* @var Plugin
    
  • */
    
  • private $delegatedPlugin;
  • /**
  • \* @param RequestMatcher $requestMatcher
    
  • \* @param Plugin         $delegatedPlugin
    
  • */
    
  • public function __construct(RequestMatcher $requestMatcher, Plugin $delegatedPlugin)

I maybe want to use more than one plugin. I suggest allowing the second
parameter to be an array of Plugins. Would that be possible?


Reply to this email directly or view it on GitHub
https://github.com/php-http/plugins/pull/65/files#r55119904.

Copy link
Member

Choose a reason for hiding this comment

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

Okey. Cool!

@sagikazarmark
Copy link
Member Author

Anyone review?

use Psr\Http\Message\RequestInterface;

/**
* Apply a delegated plugin based on a request match.
Copy link
Contributor

Choose a reason for hiding this comment

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

Execute a plugin only if the RequestMatcher matches the request.

@dbu
Copy link
Contributor

dbu commented Mar 31, 2016

would this now need to go against client-commons, now that we move the plugins there?

@sagikazarmark
Copy link
Member Author

Yes, it should. Wanted to finish it before closing and moving to common.

sagikazarmark added a commit to php-http/client-common that referenced this pull request Apr 3, 2016
sagikazarmark added a commit to php-http/client-common that referenced this pull request May 1, 2016
Update todo

Remove options resolver dependency

Revert: Remove options resolver dependency

Add AddHostPlugin

Add Authentication plugins

Add content length plugin

Add final warning to plugins

Add cookie plugin

Add decoder plugin

Add error plugin

Add header plugins

Add history plugin

Fix namespace import order

Add redirect plugin

Add retry plugin

Make plugin classes final, related #18

Fix throw keyword

Manually apply php-http/plugins#68

Manually apply and close php-http/plugins#65
sagikazarmark added a commit to php-http/client-common that referenced this pull request May 1, 2016
Update todo

Remove options resolver dependency

Revert: Remove options resolver dependency

Add AddHostPlugin

Add Authentication plugins

Add content length plugin

Add final warning to plugins

Add cookie plugin

Add decoder plugin

Add error plugin

Add header plugins

Add history plugin

Fix namespace import order

Add redirect plugin

Add retry plugin

Make plugin classes final, related #18

Fix throw keyword

Manually apply php-http/plugins#68

Manually apply and close php-http/plugins#65
sagikazarmark added a commit to php-http/client-common that referenced this pull request May 1, 2016
Update todo

Remove options resolver dependency

Revert: Remove options resolver dependency

Add AddHostPlugin

Add Authentication plugins

Add content length plugin

Add final warning to plugins

Add cookie plugin

Add decoder plugin

Add error plugin

Add header plugins

Add history plugin

Fix namespace import order

Add redirect plugin

Add retry plugin

Make plugin classes final, related #18

Fix throw keyword

Manually apply php-http/plugins#68

Manually apply and close php-http/plugins#65
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