function ContentLength::handle

Same name in this branch
  1. 10 core/lib/Drupal/Core/StackMiddleware/ContentLength.php \Drupal\Core\StackMiddleware\ContentLength::handle()
Same name in other branches
  1. 11.x core/modules/big_pipe/src/StackMiddleware/ContentLength.php \Drupal\big_pipe\StackMiddleware\ContentLength::handle()
  2. 11.x core/lib/Drupal/Core/StackMiddleware/ContentLength.php \Drupal\Core\StackMiddleware\ContentLength::handle()

File

core/modules/big_pipe/src/StackMiddleware/ContentLength.php, line 31

Class

ContentLength
Defines a big pipe middleware that removes Content-Length headers.

Namespace

Drupal\big_pipe\StackMiddleware

Code

public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = TRUE) : Response {
    $response = $this->httpKernel
        ->handle($request, $type, $catch);
    if (!$response instanceof BigPipeResponse) {
        return $response;
    }
    $response->headers
        ->remove('Content-Length');
    return $response;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.