Refactor conditional logic for response handling
- Adjusted code to handle different scenarios when processing responses.
This commit is contained in:
parent
439d658d14
commit
fd8a67c23c
10
index.php
10
index.php
@ -47,9 +47,17 @@ if(php_sapi_name() == 'cli' || $_SERVER["REQUEST_URI"] == '/metrics') {
|
||||
}
|
||||
|
||||
if (isset($submetric['http']['data']) && $submetric['http']['data'] == 'responsebody') {
|
||||
if ($hasresponse) {
|
||||
$output = $res->getBody()->getContents();
|
||||
} else {
|
||||
$output = '';
|
||||
}
|
||||
} elseif ((isset($submetric['http']['statuscode'])) && (isset($submetric['http']['data']) && $submetric['http']['data'] == 'hasresponse')) {
|
||||
$output = (int)in_array($res->getStatusCode(), $submetric['http']['statuscode']);
|
||||
if ($hasresponse) {
|
||||
$output = $output = (int)in_array($res->getStatusCode(), $submetric['http']['statuscode']);;
|
||||
} else {
|
||||
$output = 0;
|
||||
}
|
||||
} elseif (isset($submetric['http']['data']) && $submetric['http']['data'] == 'hasresponse') {
|
||||
$output = (int)$hasresponse;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user