You are here

protected function BrowserHtmlDebugTrait::formatHtmlOutputHeaders in Drupal 9

Same name and namespace in other branches
  1. 8 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 84

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>';
}