Skip to content

Commit

Permalink
allow passing of options to guzzle
Browse files Browse the repository at this point in the history
  • Loading branch information
tgloeggl committed Oct 21, 2024
1 parent 183619e commit 681b595
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/OpencastApi/Rest/OcRestClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class OcRestClient extends Client
private $noHeader = false;
private $origin;
private $features = [];
private $global_options = [];

/*
$config = [
'url' => 'https://develop.opencast.org/', // The API url of the opencast instance (required)
Expand Down Expand Up @@ -58,6 +60,8 @@ public function __construct($config)
$this->features = $config['features'];
}

$this->global_options = $config['guzzle'] ?: [];

parent::__construct($parentConstructorConfig);
}

Expand Down Expand Up @@ -101,6 +105,7 @@ public function setRequestConnectionTimeout($connectionTimeout)

private function addRequestOptions($uri, $options)
{
$globalOptions = $this->global_options;

// Perform a temp no header request.
if ($this->noHeader) {
Expand Down Expand Up @@ -150,7 +155,7 @@ private function addRequestOptions($uri, $options)
}
}

$requestOptions = array_merge($generalOptions, $options);
$requestOptions = array_merge($generalOptions, $globalOptions, $options);
return $requestOptions;
}

Expand Down

0 comments on commit 681b595

Please sign in to comment.