mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Add the HTTP Patch to the Content-Type check mechanism
Currently when a request is of type 'patch' it is ignored. This commit makes sure that the Content-Type is checked when a patch request is provided.
This commit is contained in:
parent
8cd5a64c27
commit
e31ce0d58f
2 changed files with 7 additions and 1 deletions
|
@ -505,7 +505,12 @@ class RequestHandlerComponent extends Component {
|
|||
* in the request content type will be returned.
|
||||
*/
|
||||
public function requestedWith($type = null) {
|
||||
if (!$this->request->is('post') && !$this->request->is('put') && !$this->request->is('delete')) {
|
||||
if (
|
||||
!$this->request->is('patch') &&
|
||||
!$this->request->is('post') &&
|
||||
!$this->request->is('put') &&
|
||||
!$this->request->is('delete')
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
if (is_array($type)) {
|
||||
|
|
|
@ -97,6 +97,7 @@ class CakeRequest implements ArrayAccess {
|
|||
*/
|
||||
protected $_detectors = array(
|
||||
'get' => array('env' => 'REQUEST_METHOD', 'value' => 'GET'),
|
||||
'patch' => array('env' => 'REQUEST_METHOD', 'value' => 'PATCH'),
|
||||
'post' => array('env' => 'REQUEST_METHOD', 'value' => 'POST'),
|
||||
'put' => array('env' => 'REQUEST_METHOD', 'value' => 'PUT'),
|
||||
'delete' => array('env' => 'REQUEST_METHOD', 'value' => 'DELETE'),
|
||||
|
|
Loading…
Reference in a new issue