vendredi 30 août 2019

URL not encoding correctly from Laravel Job

Using guzzle in laravel 5.8 to make external API requests in my app. When I perform a request from a controller it works fine.

How ever when using the same code in a Job which I dispatch in a controller, I dont get the same results, I get an incorrect url.

Tried using a variety of url and utf8 encoding/decoding

$name = 'Cheeríos';
$this->httpClient->get("$baseUri/" . strtolower($name) . "/info")->getBody();

actual results of url, which leads to a 404 because its removed the í from the name

example.com/user/cheer%E3%ADos/info

expected

example.com/user/cheer%C3%ADos/info
or
example.com/user/cheeríos/info



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire