Skip to content

Commit

Permalink
Merge pull request #14 from curzio-della-santa/fix/factory-default-an…
Browse files Browse the repository at this point in the history
…d-headers-setup
  • Loading branch information
Ivan Wolf committed Nov 3, 2015
2 parents 1a0defb + 719734a commit f59a433
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Denner/Client/DennerClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ public static function factory($options = array())
),
);

// If default options present, do a union with our $defaultOptions['defaults']
if (array_key_exists('defaults', $options)) {
$options['defaults'] += $defaultOptions['defaults'];
}

// $requiredOptions = array();
//
// foreach ($requiredOptions as $optionName) {
Expand All @@ -60,7 +65,10 @@ public static function factory($options = array())
}

$httpClient = new HttpClient($config->toArray());
$httpClient->setDefaultOption('headers', $headers);
$httpClient->setDefaultOption(
'headers',
array_merge($httpClient->getDefaultOption('headers') ?: array(), $headers)
);
$httpClient->getEmitter()->attach(new Subscriber\ErrorHandler());

$serviceDescriptionFile = __DIR__ . sprintf('/ServiceDescription/%s.php', self::getServiceDescriptionName());
Expand Down

0 comments on commit f59a433

Please sign in to comment.