Permalink
Browse files

Adding support for HTTP_X_HTTP_METHOD_OVERRIDE (and a minor bugfix) t…

…o Controller_REST - Fixes #3160
  • Loading branch information...
1 parent 11e937d commit 2662973957735588d6916fa1f989eef70a28433b @kiall kiall committed Dec 20, 2010
Showing with 4 additions and 2 deletions.
  1. +4 −2 classes/kohana/controller/rest.php
@@ -49,13 +49,15 @@ public function before()
{
$this->_action_requested = $this->request->action();
- if ( ! isset($this->_action_map[$this->request->method]))
+ $method = isset($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE']) ? $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] : $this->request->method();
+
+ if ( ! isset($this->_action_map[$method]))
{
$this->request->action('invalid');
}
else
{
- $this->request->action($this->_action_map[$this->request->method]);
+ $this->request->action($this->_action_map[$method]);
}
return parent::before();

0 comments on commit 2662973

Please sign in to comment.