-
Notifications
You must be signed in to change notification settings - Fork 50
Add AddPathPlugin support. ISSUE-255 #256
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 AddPathPlugin support. ISSUE-255 #256
Conversation
I'll create the doc PR once this PR is approved by the maintainers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks a lot, looks all correct to me!
one detail: in semver, new features go into new minor versions. can you please change the changelog to say 1.10.0 and adjust the branch-alias in composer.json to 1.10 as well?
CHANGELOG.md
Outdated
@@ -2,6 +2,12 @@ | |||
|
|||
The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release. | |||
|
|||
## 1.9.1 (unreleased) - 2018-03-09 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new features go into new minor versions. this should be 1.10.0
please also start the documentation pull request, i think the configuration will look exactly as you propose here. |
Added information relative to php-http/HttplugBundle#256 . As an example using add_path configuration
Done the semver version fix and the PR in de docs :) Thanks to @llaakkkk for the job in the base_uri PR as this is HEAVILY based on it ;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, just realized that there is no "replace" for path. the path is just prepended to each request.
->isRequired() | ||
->cannotBeEmpty() | ||
->end() | ||
->scalarNode('replace') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you sure about this one? looking at https://github.com/php-http/client-common/blob/master/src/Plugin/AddPathPlugin.php i think there is only the uri argument.
a request always has a path, so i think for path this just always prepends a path when configured, and there is no replace
argument.
$this->createUri($container, $pathUriService, $config['path']); | ||
$definition->replaceArgument(0, new Reference($pathUriService)); | ||
$definition->replaceArgument(1, [ | ||
'replace' => $config['replace'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no argument 1 to the AddPath plugin
Resources/config/plugins.xml
Outdated
@@ -34,6 +34,10 @@ | |||
<argument/> | |||
<argument/> | |||
</service> | |||
<service id="httplug.plugin.add_path" class="Http\Client\Common\Plugin\AddPathPlugin" public="false" abstract="true"> | |||
<argument/> | |||
<argument/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also remove this please
'add_path' => [ | ||
'enabled' => true, | ||
'path' => '/api/v1', | ||
'replace' => false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and remove this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gave it a quick review. It looks good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
What's in this PR?
Add AddPathPlugin support
Why?
#255
Example Usage
http://docs.php-http.org/en/latest/plugins/request-uri-manipulations.html
Checklist