Skip to content

Commit

Permalink
Added minor optimizations to request handler
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed May 31, 2016
1 parent 445e0cc commit 709c1ef
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Controller/Component/RequestHandlerComponent.php
Expand Up @@ -159,7 +159,7 @@ public function initialize(array $config)
protected function _setExtension($request, $response)
{
$accept = $request->parseAccept();
if (empty($accept)) {
if (empty($accept) || current($accept)[0] === 'text/html') {
return;
}

Expand Down Expand Up @@ -202,11 +202,16 @@ public function startup(Event $event)
if (empty($this->ext) || in_array($this->ext, ['html', 'htm'])) {
$this->_setExtension($request, $this->response);
}
if (empty($this->ext) && $request->is('ajax')) {

$request->params['isAjax'] = $request->is('ajax');

if (empty($this->ext) && $request->params['isAjax']) {
$this->ext = 'ajax';
}

$request->params['isAjax'] = $this->request->is('ajax');
if ($request->is(['get', 'head', 'options'])) {
return;
}

foreach ($this->config('inputTypeMap') as $type => $handler) {
if (!is_callable($handler[0])) {
Expand Down

0 comments on commit 709c1ef

Please sign in to comment.