cuzzle icon indicating copy to clipboard operation
cuzzle copied to clipboard

Does not extract headers if passed as options to Guzzle

Open Einenlum opened this issue 6 years ago • 0 comments

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']]
);

Einenlum avatar Oct 29 '18 12:10 Einenlum