function BrowserHtmlDebugTrait::formatHtmlOutputHeaders

Same name in other branches
  1. 9 core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php \Drupal\Tests\BrowserHtmlDebugTrait::formatHtmlOutputHeaders()
  2. 8.9.x core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php \Drupal\Tests\BrowserHtmlDebugTrait::formatHtmlOutputHeaders()
  3. 11.x core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php \Drupal\Tests\BrowserHtmlDebugTrait::formatHtmlOutputHeaders()

Formats HTTP headers as string for HTML output logging.

Parameters

array[] $headers: Headers that should be formatted.

Return value

string The formatted HTML string.

2 calls to BrowserHtmlDebugTrait::formatHtmlOutputHeaders()
BrowserHtmlDebugTrait::getHtmlOutputHeaders in core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php
Returns headers in HTML output format.
BrowserHtmlDebugTrait::getResponseLogHandler in core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php
Provides a Guzzle middleware handler to log every response received.

File

core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php, line 86

Class

BrowserHtmlDebugTrait
Provides the debug functions for browser tests.

Namespace

Drupal\Tests

Code

protected function formatHtmlOutputHeaders(array $headers) {
    $flattened_headers = array_map(function ($header) {
        if (is_array($header)) {
            return implode(';', array_map('trim', $header));
        }
        else {
            return $header;
        }
    }, $headers);
    return '<hr />Headers: <pre>' . Html::escape(var_export($flattened_headers, TRUE)) . '</pre>';
}

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