mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-30 04:01:47 +00:00
Update article in Curl::diagnose() Allow header warning
This commit is contained in:
@@ -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
@@ -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";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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',
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user