performance improvement of JsonResponse saving 2 assignments and 1 variable
This commit is contained in:
parent
54ce7c75e8
commit
c3483d0eb9
@ -91,15 +91,15 @@ class JsonResponse extends Response
|
|||||||
*/
|
*/
|
||||||
protected function update()
|
protected function update()
|
||||||
{
|
{
|
||||||
$content = $this->data;
|
|
||||||
$this->headers->set('Content-Type', 'application/json', false);
|
|
||||||
|
|
||||||
if ($this->callback) {
|
if ($this->callback) {
|
||||||
$content = sprintf('%s(%s);', $this->callback, $content);
|
|
||||||
// Not using application/javascript for compatibility reasons with older browsers.
|
// Not using application/javascript for compatibility reasons with older browsers.
|
||||||
$this->headers->set('Content-Type', 'text/javascript', true);
|
$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