Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allows method emulation to be determined via X-HTTP-Method-Override r…

…equest header.
  • Loading branch information...
commit 6be49b5583eb679d64bae6e82180acaefdda398d 1 parent cdc29f1
@cnanney authored
Showing with 10 additions and 2 deletions.
  1. +10 −2 application/libraries/REST_Controller.php
View
12 application/libraries/REST_Controller.php
@@ -403,10 +403,18 @@ protected function _detect_output_format()
protected function _detect_method()
{
$method = strtolower($this->input->server('REQUEST_METHOD'));
+ $request_headers = apache_request_headers();
- if ($this->config->item('enable_emulate_request') && $this->input->post('_method'))
+ if ($this->config->item('enable_emulate_request'))
{
- $method = strtolower($this->input->post('_method'));
+ if ($this->input->post('_method'))
+ {
+ $method = strtolower($this->input->post('_method'));
+ }
+ else if (isset($request_headers['X-HTTP-Method-Override']))
+ {
+ $method = strtolower($request_headers['X-HTTP-Method-Override']);
+ }
}
if (in_array($method, array('get', 'delete', 'post', 'put')))
Please sign in to comment.
Something went wrong with that request. Please try again.