needsParsing example

$response = new Response('foo');
        $esi->addSurrogateControl($response);
        $this->assertEquals('', $response->headers->get('Surrogate-Control'));
    }

    public function testNeedsEsiParsing()
    {
        $esi = new Esi();

        $response = new Response();
        $response->headers->set('Surrogate-Control', 'content="ESI/1.0"');
        $this->assertTrue($esi->needsParsing($response));

        $response = new Response();
        $this->assertFalse($esi->needsParsing($response));
    }

    public function testRenderIncludeTag()
    {
        $esi = new Esi();

        $this->assertEquals('<esi:include src="/" onerror="continue" alt="/alt" />', $esi->renderIncludeTag('/', '/alt', true));
        $this->assertEquals('<esi:include src="/" alt="/alt" />', $esi->renderIncludeTag('/', '/alt', false));
        
return;
        }

        $response->headers->remove('X-Body-File');
    }

    /** * @return void */
    protected function processResponseBody(Request $request, Response $response)
    {
        if ($this->surrogate?->needsParsing($response)) {
            $this->surrogate->process($request$response);
        }
    }

    /** * Checks if the Request includes authorization or other sensitive information * that should cause the Response to be considered private by default. */
    private function isPrivateRequest(Request $request): bool
    {
        foreach ($this->options['private_headers'] as $key) {
            
return;
        }

        $response->headers->remove('X-Body-File');
    }

    /** * @return void */
    protected function processResponseBody(Request $request, Response $response)
    {
        if ($this->surrogate?->needsParsing($response)) {
            $this->surrogate->process($request$response);
        }
    }

    /** * Checks if the Request includes authorization or other sensitive information * that should cause the Response to be considered private by default. */
    private function isPrivateRequest(Request $request): bool
    {
        foreach ($this->options['private_headers'] as $key) {
            
$response = new Response('foo');
        $ssi->addSurrogateControl($response);
        $this->assertEquals('', $response->headers->get('Surrogate-Control'));
    }

    public function testNeedsSsiParsing()
    {
        $ssi = new Ssi();

        $response = new Response();
        $response->headers->set('Surrogate-Control', 'content="SSI/1.0"');
        $this->assertTrue($ssi->needsParsing($response));

        $response = new Response();
        $this->assertFalse($ssi->needsParsing($response));
    }

    public function testRenderIncludeTag()
    {
        $ssi = new Ssi();

        $this->assertEquals('<!--#include virtual="/" -->', $ssi->renderIncludeTag('/', '/alt', true));
        $this->assertEquals('<!--#include virtual="/" -->', $ssi->renderIncludeTag('/', '/alt', false));
        
Home | Imprint | This part of the site doesn't use cookies.