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

GuzzleHttp Client `base_uri` option is being ignored #328

Closed
ghost opened this Issue Nov 30, 2017 · 1 comment

Comments

Projects
None yet
1 participant
@ghost

ghost commented Nov 30, 2017

How to reproduce

<?php

$client = new GuzzleClient(['base_uri' => 'https://raw.githubusercontent.com']);
$body = $client->request('get', '/FriendsOfPHP/Goutte/master/box.json')->getBody()->getContents();

Works as expected, but

<?php

$client = new Client();
$client->setClient(new GuzzleClient(['base_uri' => 'https://raw.githubusercontent.com']));
$body = $client->request('get', '/FriendsOfPHP/Goutte/master/box.json')->html();

doesn't work.

Expected

{
    "output": "goutte.phar",
    "chmod": "0755",
    "compactors": [
        "Herrera\\Box\\Compactor\\Php"
    ],
    "extract": false,
    "files": [
        "LICENSE",
        "Goutte/Client.php"
    ],
    "finder": [
        {
            "name": ["*.php", "*.pem*"],
            "exclude": ["Tests", "tests"],
            "in": "vendor"
        }
    ],
    "stub": "Goutte/Resources/phar-stub.php",
    "web": false
}

Actual

<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr>
<center>nginx/1.10.3 (Ubuntu)</center>
</body>

If use var_dump on the object, we can see this:

protected 'uri' => string 'http://localhost/FriendsOfPHP/Goutte/master/box.json'
@trinvh

This comment has been minimized.

Show comment
Hide comment
@trinvh

trinvh May 14, 2018

Any updates on this?

trinvh commented May 14, 2018

Any updates on this?

@fabpot fabpot closed this in #349 Jun 29, 2018

fabpot added a commit that referenced this issue Jun 29, 2018

feature #349 Support setting Guzzle's "base_uri" option (dunglas)
This PR was merged into the 3.2-dev branch.

Discussion
----------

Support setting Guzzle's "base_uri" option

Allow to set a base URI. Fix #328.

Commits
-------

71dc217 Support setting Guzzle's "base_uri" option
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment