Update article in Curl::diagnose() Allow header warning

This commit is contained in:
Zach Borboa
2023-05-07 02:50:08 -07:00
parent 58f03b1699
commit 5b39126488
4 changed files with 15 additions and 10 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ $multi_curl->beforeSend(function ($instance) {
echo 'about to make request ' . $instance->id . ': "' . $instance->url . '".' . "\n";
});
$multi_curl->success(function ($instance) use (&$request_count, $multi_curl) {
$multi_curl->success(function ($instance) use ($multi_curl) {
echo 'call to "' . $instance->url . '" was successful.' . "\n";
// Stop pending requests and attempt to stop active requests after the first
+2 -2
View File
@@ -1337,8 +1337,8 @@ class Curl extends BaseCurl
foreach ($request_types as $http_method_name => $http_method_used) {
if ($http_method_used && !in_array($http_method_name, $allowed_request_types, true)) {
echo
'Warning: A ' . $http_method_name . ' request was made, but only the following request ' .
'types are allowed: ' . implode(', ', $allowed_request_types) . "\n";
'Warning: An HTTP ' . $http_method_name . ' request was made, but only the following ' .
'request types are allowed: ' . implode(', ', $allowed_request_types) . "\n";
}
}
}
+10 -5
View File
@@ -4198,35 +4198,40 @@ class PHPCurlClassTest extends \PHPUnit\Framework\TestCase
'allow_header_name' => 'Allow',
'allow_header_value' => 'POST, OPTIONS',
'expected' =>
'Warning: A GET request was made, but only the following request types are allowed: POST, OPTIONS',
'Warning: An HTTP GET request was made, but only the following request types are allowed: ' .
'POST, OPTIONS',
],
[
'http_method' => 'GET',
'allow_header_name' => 'allow',
'allow_header_value' => 'OPTIONS, POST',
'expected' =>
'Warning: A GET request was made, but only the following request types are allowed: OPTIONS, POST',
'Warning: An HTTP GET request was made, but only the following request types are allowed: ' .
'OPTIONS, POST',
],
[
'http_method' => 'POST',
'allow_header_name' => 'allow',
'allow_header_value' => 'GET, OPTIONS',
'expected' =>
'Warning: A POST request was made, but only the following request types are allowed: GET, OPTIONS',
'Warning: An HTTP POST request was made, but only the following request types are allowed: ' .
'GET, OPTIONS',
],
[
'http_method' => 'POST',
'allow_header_name' => 'allow',
'allow_header_value' => 'GET,OPTIONS',
'expected' =>
'Warning: A POST request was made, but only the following request types are allowed: GET, OPTIONS',
'Warning: An HTTP POST request was made, but only the following request types are allowed: ' .
'GET, OPTIONS',
],
[
'http_method' => 'POST',
'allow_header_name' => 'ALLOW',
'allow_header_value' => 'get,options',
'expected' =>
'Warning: A POST request was made, but only the following request types are allowed: GET, OPTIONS',
'Warning: An HTTP POST request was made, but only the following request types are allowed: ' .
'GET, OPTIONS',
],
];
+2 -2
View File
@@ -149,6 +149,6 @@ fi
-s \
.
if [[ "${?}" -ne 0 ]]; then
echo "Error: found standard violation(s)"
errors+=("found standard violation(s)")
echo "Error: found coding standard violation(s)"
errors+=("found coding standard violation(s)")
fi