I am having an issue with an app created in Lumen and Guzzlehttp requests.
Looks like I cannot pass options like JSON_UNESCAPED_SLASHES
whenever I am doing a request:
$response = (new Client())->request($this->typeRequest, $endpoint, $options);
This is hitting my server with escaped slashes ("one\/two"
) and causing some troubles.
Everything seems to be related with the vendor/guzzlehttp/guzzle/src/Client.php into applyOptions() function which is using jsonEncode and not giving the option to pass anything:
$options['body'] = Utils::jsonEncode($options['json']);
This can be easily fixed just putting the option into jsonEncode
:
$options['body'] = Utils::jsonEncode($options['json'], JSON_UNESCAPED_SLASHES);
The issue here is in case I am updating something with composer then will be override.
How can I resolve an issue like this?