Skip to content

Commit 0a8a186

Browse files
committed
Merge pull request #75 from LExpress/options
Add OPTIONS method for CORS
2 parents 060612d + 925e1f5 commit 0a8a186

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/request/sfRequest.class.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ abstract class sfRequest implements ArrayAccess
2727
const PUT = 'PUT';
2828
const DELETE = 'DELETE';
2929
const HEAD = 'HEAD';
30+
const OPTIONS = 'OPTIONS';
3031

3132
protected
3233
$dispatcher = null,
@@ -147,7 +148,7 @@ public function getMethod()
147148
*/
148149
public function setMethod($method)
149150
{
150-
if (!in_array(strtoupper($method), array(self::GET, self::POST, self::PUT, self::DELETE, self::HEAD)))
151+
if (!in_array(strtoupper($method), array(self::GET, self::POST, self::PUT, self::DELETE, self::HEAD, self::OPTIONS)))
151152
{
152153
throw new sfException(sprintf('Invalid request method: %s.', $method));
153154
}

lib/request/sfWebRequest.class.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ public function initialize(sfEventDispatcher $dispatcher, $parameters = array(),
126126
$this->setMethod(self::HEAD);
127127
break;
128128

129+
case 'OPTIONS':
130+
$this->setMethod(self::OPTIONS);
131+
break;
132+
129133
default:
130134
$this->setMethod(self::GET);
131135
}

0 commit comments

Comments
 (0)