1

When using a StreamedResponse in Symfony2/3, I cannot see the Web Debug Toolbar.

Another answer indicates "there only needs to be valid HTML with a <body>", but even with this code

public function indexAction()
{
    $sr = new StreamedResponse();
    $sr->setCallback(function() {
        echo  "<!DOCTYPE html><html><head><title>Where is the bar?</title></head><body><p>Hi. Can I haz bar pleeze?</p></body></html>";
        flush();
    });
    $sr->send();
    return $sr;
    //return $this->render('index.html.twig');
}

I cannot make the bar appear.

Is this something related to the nature of the StreamedResponse? Or is there someting I need to call on the response to let symfony know the bar should be added to this response as well?

2
  • 1
    Have you tried returning the response instead of calling send() yourself? I don't think you'll be able to see the toolbar as the response is not present at the time Symfony injects it. You should see the the token and link to the toolbar in the headers though. Commented May 10, 2016 at 6:56
  • Have you added "app_dev.php" to your URL? That should add the Web debug toolbar. You also need to edit the @$_SERVER['REMOTE_ADDR'] line in the app_dev.php file. Commented May 20, 2016 at 5:18

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.