Skip to content

Commit

Permalink
Merge pull request #57 from DFoxinator/access
Browse files Browse the repository at this point in the history
access mode
  • Loading branch information
DFoxinator committed Feb 21, 2024
2 parents e690f16 + 452930a commit edc2c99
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/HttpClient/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Client
const CONFIG_CYPHER_RETRY_MAX_INTERVAL_MS = 'cypher_retry_max_interval_ms';
const CONFIG_REQUEST_MAX_RETRIES = 'request_max_retries';
const CONFIG_REQUEST_RETRY_INTERVAL_MS = 'request_retry_interval_ms';

const CONFIG_ACCESS_MODE = 'access_mode';
const ERROR_MODE_HIDE_ERRORS = 'hide';
const ERROR_MODE_THROW_ERRORS = 'throw';

Expand All @@ -38,6 +38,7 @@ class Client
self::CONFIG_CYPHER_RETRY_MAX_INTERVAL_MS => 50,
self::CONFIG_REQUEST_MAX_RETRIES => 0,
self::CONFIG_REQUEST_RETRY_INTERVAL_MS => 300,
self::CONFIG_ACCESS_MODE => null,
];

const RETRYABLE_CYPHER_ERROR_CODES = [
Expand Down Expand Up @@ -99,6 +100,12 @@ public function getCypherMaxRetries() : int
return $this->_config[self::CONFIG_CYPHER_MAX_RETRIES];
}

public function getAccessMode() : ?string {

return $this->_config[self::CONFIG_ACCESS_MODE];

}

public function getCypherRetryIntervalMs() : int
{
return $this->_config[self::CONFIG_CYPHER_RETRY_MAX_INTERVAL_MS];
Expand Down Expand Up @@ -238,6 +245,12 @@ private function _getRequestHeaders() : array
$headers['Authorization'] = 'Basic ' . base64_encode($this->_config['username'] . ':' . $this->_config['password']);
}

$access_mode = $this->getAccessMode();

if ($access_mode && is_string($access_mode)) {
$headers['Access-Mode'] = $access_mode;
}

return $headers;
}

Expand Down

0 comments on commit edc2c99

Please sign in to comment.