From 9dc28be57732dd055d479d7eb1b03080b1bbffde Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Tue, 23 Jun 2015 11:49:19 -0300 Subject: [PATCH] Support HTTP_X_HTTP_METHOD_OVERRIDE in API old versions --- includes/api/v1/class-wc-api-server.php | 2 ++ includes/api/v2/class-wc-api-server.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/includes/api/v1/class-wc-api-server.php b/includes/api/v1/class-wc-api-server.php index f6b14ccf30b..8abdea33ee1 100644 --- a/includes/api/v1/class-wc-api-server.php +++ b/includes/api/v1/class-wc-api-server.php @@ -133,6 +133,8 @@ class WC_API_Server { // Compatibility for clients that can't use PUT/PATCH/DELETE if ( isset( $_GET['_method'] ) ) { $this->method = strtoupper( $_GET['_method'] ); + } elseif ( isset( $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] ) ) { + $this->method = $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE']; } // determine type of request/response and load handler, JSON by default diff --git a/includes/api/v2/class-wc-api-server.php b/includes/api/v2/class-wc-api-server.php index 01086308f7d..d3311232690 100644 --- a/includes/api/v2/class-wc-api-server.php +++ b/includes/api/v2/class-wc-api-server.php @@ -133,6 +133,8 @@ class WC_API_Server { // Compatibility for clients that can't use PUT/PATCH/DELETE if ( isset( $_GET['_method'] ) ) { $this->method = strtoupper( $_GET['_method'] ); + } elseif ( isset( $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] ) ) { + $this->method = $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE']; } // load response handler