Definition at line 16 of file HttpUtils.php.
◆ checkLicenseDBHealth()
static Fossology\Lib\Util\HttpUtils::checkLicenseDBHealth |
( |
string |
$getHealth, |
|
|
|
$guzzleClient |
|
) |
| |
|
static |
Checks the health status of the license database by sending a GET request to a specified health endpoint. Returns a boolean result indicating whether the database is reachable and healthy. Implements error handling for HTTP request failures.
- Returns
- bool True if the database health check succeeds with an HTTP 200 response, false otherwise.
Definition at line 62 of file HttpUtils.php.
◆ getGuzzleClient()
static Fossology\Lib\Util\HttpUtils::getGuzzleClient |
( |
array |
$SysConf, |
|
|
string |
$baseUri, |
|
|
string |
$token = "" |
|
) |
| |
|
static |
Create a preconfigured Guzzle Client.
- Parameters
-
array | $SysConf | SysConf array |
string | $baseUri | Base URI of the client |
string | $token | Authentication token. Leave empty if not needed. |
- Returns
- Client Guzzle Client configured with proxy
Definition at line 25 of file HttpUtils.php.
◆ processHttpResponse()
static Fossology\Lib\Util\HttpUtils::processHttpResponse |
( |
|
$response | ) |
|
|
static |
Processes an HTTP response and handles it based on the status code.
This function evaluates the HTTP response status code and performs the following:
- For a 200 status code, it decodes the JSON response body and validates the data.
- For other status codes, it throws exceptions with appropriate error messages.
- Parameters
-
\Psr\Http\Message\ResponseInterface | $response | The HTTP response object to process. |
- Returns
- mixed Decoded JSON data from the response body if the status code is 200.
- Exceptions
-
HttpClientException | If the response contains errors, invalid JSON, or unexpected status codes. |
Definition at line 89 of file HttpUtils.php.
The documentation for this class was generated from the following file: