Skip to content

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

Merged
merged 3 commits into from
Mar 8, 2018

Conversation

enekochan
Copy link
Contributor

@enekochan enekochan commented Mar 7, 2018

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Related tickets fixes #255
Documentation ToDo
License MIT

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

@enekochan
Copy link
Contributor Author

I'll create the doc PR once this PR is approved by the maintainers.

Copy link
Collaborator

@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.

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
Copy link
Collaborator

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

@dbu
Copy link
Collaborator

dbu commented Mar 8, 2018

please also start the documentation pull request, i think the configuration will look exactly as you propose here.

enekochan added a commit to enekochan/documentation that referenced this pull request Mar 8, 2018
Added information relative to php-http/HttplugBundle#256 . As an example using add_path configuration
@enekochan
Copy link
Contributor Author

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 ;)

Copy link
Collaborator

@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.

sorry, just realized that there is no "replace" for path. the path is just prepended to each request.

->isRequired()
->cannotBeEmpty()
->end()
->scalarNode('replace')
Copy link
Collaborator

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'],
Copy link
Collaborator

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

@@ -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/>
Copy link
Collaborator

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,
Copy link
Collaborator

Choose a reason for hiding this comment

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

and remove this

Copy link
Member

@Nyholm Nyholm left a 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

Copy link
Collaborator

@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.

thanks!

@dbu dbu merged commit 5c4db94 into php-http:master Mar 8, 2018
dbu pushed a commit to php-http/documentation that referenced this pull request Mar 8, 2018
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.

Include support for AddPathPlugin with just some configuration
3 participants