Make WordPress Core

Changeset 38192


Ignore:
Timestamp:
08/04/2016 07:21:18 AM (10 years ago)
Author:
dd32
Message:

Requests: Merge handling for custom HTTP methods.

This merges the latest changes to Requests from upstream to add support for custom HTTP methods.
See ​https://github.com/rmccue/Requests/commit/1b5ffd8501503e0641b7fa0c555ccf99973135e2

Props Ipstenu, ocean90.
Merges [38191] to the 4.6 branch.
Fixes #37503 for 4.6.

Location:
branches/4.6
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.6

  • branches/4.6/src/wp-includes/Requests/Transport/cURL.php

    r38049 r38192  
    334334                                curl_setopt($this->handle, CURLOPT_POSTFIELDS, $data);
    335335                                break;
    336                         case Requests::PATCH:
    337                         case Requests::PUT:
    338                         case Requests::DELETE:
    339                         case Requests::OPTIONS:
    340                                 curl_setopt($this->handle, CURLOPT_CUSTOMREQUEST, $options['type']);
    341                                 curl_setopt($this->handle, CURLOPT_POSTFIELDS, $data);
    342                                 break;
    343336                        case Requests::HEAD:
    344337                                curl_setopt($this->handle, CURLOPT_CUSTOMREQUEST, $options['type']);
    … …  
    348341                                curl_setopt($this->handle, CURLOPT_CUSTOMREQUEST, $options['type']);
    349342                                break;
     343                        case Requests::PATCH:
     344                        case Requests::PUT:
     345                        case Requests::DELETE:
     346                        case Requests::OPTIONS:
     347                        default:
     348                                curl_setopt($this->handle, CURLOPT_CUSTOMREQUEST, $options['type']);
     349                                if (!empty($data)) {
     350                                        curl_setopt( $this->handle, CURLOPT_POSTFIELDS, $data );
     351                                }
    350352                }
    351353
Note: See TracChangeset for help on using the changeset viewer.