Skip to content

Commit 6be49b5

Browse files
committed
Allows method emulation to be determined via X-HTTP-Method-Override request header.
1 parent cdc29f1 commit 6be49b5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

application/libraries/REST_Controller.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,10 +403,18 @@ protected function _detect_output_format()
403403
protected function _detect_method()
404404
{
405405
$method = strtolower($this->input->server('REQUEST_METHOD'));
406+
$request_headers = apache_request_headers();
406407

407-
if ($this->config->item('enable_emulate_request') && $this->input->post('_method'))
408+
if ($this->config->item('enable_emulate_request'))
408409
{
409-
$method = strtolower($this->input->post('_method'));
410+
if ($this->input->post('_method'))
411+
{
412+
$method = strtolower($this->input->post('_method'));
413+
}
414+
else if (isset($request_headers['X-HTTP-Method-Override']))
415+
{
416+
$method = strtolower($request_headers['X-HTTP-Method-Override']);
417+
}
410418
}
411419

412420
if (in_array($method, array('get', 'delete', 'post', 'put')))

0 commit comments

Comments
 (0)