merged branch Tobion/patch-2 (PR #3679)
Commits
-------
c3483d0
performance improvement of JsonResponse saving 2 assignments and 1 variable
Discussion
----------
performance improvement of JsonResponse
saving 2 assignments and 1 variable
This commit is contained in:
commit
8c2f4fdb49
@ -91,15 +91,15 @@ class JsonResponse extends Response
|
||||
*/
|
||||
protected function update()
|
||||
{
|
||||
$content = $this->data;
|
||||
$this->headers->set('Content-Type', 'application/json', false);
|
||||
|
||||
if ($this->callback) {
|
||||
$content = sprintf('%s(%s);', $this->callback, $content);
|
||||
// Not using application/javascript for compatibility reasons with older browsers.
|
||||
$this->headers->set('Content-Type', 'text/javascript', true);
|
||||
|
||||
return $this->setContent(sprintf('%s(%s);', $this->callback, $this->data));
|
||||
}
|
||||
|
||||
return $this->setContent($content);
|
||||
$this->headers->set('Content-Type', 'application/json', false);
|
||||
|
||||
return $this->setContent($this->data);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user