mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 21:08:44 +01:00
Requests: Merge handling for custom HTTP methods.
This merges the latest changes to Requests from upstream to add support for custom HTTP methods.
See 1b5ffd8501
Props Ipstenu, ocean90.
Merges [38191] to the 4.6 branch.
Fixes #37503 for 4.6.
git-svn-id: https://develop.svn.wordpress.org/branches/4.6@38192 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8aa0bac010
commit
0342ead47e
@ -333,13 +333,6 @@ class Requests_Transport_cURL implements Requests_Transport {
|
||||
curl_setopt($this->handle, CURLOPT_POST, true);
|
||||
curl_setopt($this->handle, CURLOPT_POSTFIELDS, $data);
|
||||
break;
|
||||
case Requests::PATCH:
|
||||
case Requests::PUT:
|
||||
case Requests::DELETE:
|
||||
case Requests::OPTIONS:
|
||||
curl_setopt($this->handle, CURLOPT_CUSTOMREQUEST, $options['type']);
|
||||
curl_setopt($this->handle, CURLOPT_POSTFIELDS, $data);
|
||||
break;
|
||||
case Requests::HEAD:
|
||||
curl_setopt($this->handle, CURLOPT_CUSTOMREQUEST, $options['type']);
|
||||
curl_setopt($this->handle, CURLOPT_NOBODY, true);
|
||||
@ -347,6 +340,15 @@ class Requests_Transport_cURL implements Requests_Transport {
|
||||
case Requests::TRACE:
|
||||
curl_setopt($this->handle, CURLOPT_CUSTOMREQUEST, $options['type']);
|
||||
break;
|
||||
case Requests::PATCH:
|
||||
case Requests::PUT:
|
||||
case Requests::DELETE:
|
||||
case Requests::OPTIONS:
|
||||
default:
|
||||
curl_setopt($this->handle, CURLOPT_CUSTOMREQUEST, $options['type']);
|
||||
if (!empty($data)) {
|
||||
curl_setopt( $this->handle, CURLOPT_POSTFIELDS, $data );
|
||||
}
|
||||
}
|
||||
|
||||
// cURL requires a minimum timeout of 1 second when using the system
|
||||
|
Loading…
x
Reference in New Issue
Block a user