Skip to content

Commit

Permalink
Request handler patch.
Browse files Browse the repository at this point in the history
Ensure the correct method is shown for messaging.
  • Loading branch information
Maikuolan committed Dec 24, 2023
1 parent 1f748a9 commit ab077a3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ public function request($URI, $Params = [], $Timeout = -1, array $Headers = [],
}
if ($Method !== '') {
curl_setopt($Request, CURLOPT_CUSTOMREQUEST, $Method);
$DebugMethod = $Method;
} else {
$DebugMethod = $Post ? 'POST' : 'GET';
}
curl_setopt($Request, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($Request, CURLOPT_MAXREDIRS, 1);
Expand All @@ -192,7 +195,7 @@ public function request($URI, $Params = [], $Timeout = -1, array $Headers = [],

/** Check for problems (e.g., resource not found, server errors, etc). */
if (($Info = curl_getinfo($Request)) && is_array($Info) && isset($Info['http_code'])) {
$this->sendMessage(sprintf('%s - %s - %s - %s', $Post ? 'POST' : 'GET', $URI, $Info['http_code'], (floor($Time * 100) / 100) . 's'));
$this->sendMessage(sprintf('%s - %s - %s - %s', $DebugMethod, $URI, $Info['http_code'], (floor($Time * 100) / 100) . 's'));

/** Most recent HTTP status code. */
$this->MostRecentStatusCode = $Info['http_code'];
Expand All @@ -203,7 +206,7 @@ public function request($URI, $Params = [], $Timeout = -1, array $Headers = [],
return $this($AlternateURI, $Params, $Timeout, $Headers, $Depth + 1, $Method);
}
} else {
$this->sendMessage(sprintf('%s - %s - %s - %s', $Post ? 'POST' : 'GET', $URI, 200, (floor($Time * 100) / 100) . 's'));
$this->sendMessage(sprintf('%s - %s - %s - %s', $DebugMethod, $URI, 200, (floor($Time * 100) / 100) . 's'));

/** Most recent HTTP status code. */
$this->MostRecentStatusCode = 200;
Expand Down

0 comments on commit ab077a3

Please sign in to comment.