Skip to content

Include support for AddPathPlugin with just some configuration #255

Closed
@enekochan

Description

@enekochan
Q A
Bug? no
New Feature? yes

Actual Behavior

I needed to add a base path for all the requests done with a specific client. Httplug has support for this feature with AddPathPlugin but the HttplugBundle does not include it AFAIK (as it does for AddHostPlugin). For now I've followed a similar solution as done in #110 (thanks @dbu BTW :D).

services:
    app.http.path_uri:
        class: Psr\Http\Message\UriInterface
        factory: ["@httplug.uri_factory", createUri]
        arguments: ["%acme_client.api_path%"]

    app.http.plugin.add_path:
        class: Http\Client\Common\Plugin\AddPathPlugin
        arguments: ["@app.http.path_uri"]
httplug:
    clients:
        acme:
            factory: 'httplug.factory.guzzle6'
            plugins:
                - 'app.http.plugin.add_path'

Expected Behavior

Be able to add a base path with just some configuration:

httplug:
    clients:
        acme:
            factory: 'httplug.factory.guzzle6'
            plugins:
                - add_path:
                    path: '%acme_client.api_path%'

Possible Solutions

Add AddPathPlugin to HttplugBundle similar to AddHostPlugin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions