cuzzle
cuzzle copied to clipboard
Does not extract headers if passed as options to Guzzle
Cuzzle formats correctly headers when they are passed to the Request object, but not when passed to the array options of Guzzle. These two pieces of code should return the same value, but they don't.
<?php
use Namshi\Cuzzle\Formatter\CurlFormatter;
use GuzzleHttp\Psr7\Request;
require_once(__DIR__.'/vendor/autoload.php');
// curl 'http://some-url.com/path' -H 'Some-Header: lorem'
echo (new CurlFormatter())->format(
new Request('get', 'http://some-url.com/path', ['Some-Header' => 'lorem']),
[]
);
// curl 'http://some-url.com/path'
echo (new CurlFormatter())->format(
new Request('get', 'http://some-url.com/path'),
['headers' => ['Some-Header' => 'lorem']]
);