Skip to content

Commit

Permalink
fix unauthorized access to check the version as for aux object,
Browse files Browse the repository at this point in the history
fixes #28
  • Loading branch information
ferishili committed Sep 19, 2024
1 parent 34dee9a commit cc40e50
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/OpencastApi/Rest/OcRestClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,10 @@ public function hasVersion($version)
// We have to use an aux object, in order to prevent overwriting arguments of current object.
$aux = clone $this;
$aux->enableNoHeader();
$defaultVersion = $aux->performGet('/api/version/default');
$options = [
'auth' => [$this->username, $this->password]
];
$defaultVersion = $aux->performGet('/api/version/default', $options);
if (!empty($defaultVersion['body']) && isset($defaultVersion['body']->default)) {
$this->setVersion(str_replace(['application/', 'v', '+json'], ['', '', ''], $defaultVersion['body']->default));
} else {
Expand Down

0 comments on commit cc40e50

Please sign in to comment.