You are here

private function MessageTrait::trimHeaderValues in Auth0 Single Sign On 8.2

Trims whitespace from the header values.

Spaces and tabs ought to be excluded by parsers when extracting the field value from a header field.

header-field = field-name ":" OWS field-value OWS OWS = *( SP / HTAB )

Parameters

string[] $values Header values:

Return value

string[] Trimmed header values

See also

https://tools.ietf.org/html/rfc7230#section-3.2.4

1 call to MessageTrait::trimHeaderValues()
MessageTrait::normalizeHeaderValue in vendor/guzzlehttp/psr7/src/MessageTrait.php

File

vendor/guzzlehttp/psr7/src/MessageTrait.php, line 186

Class

MessageTrait
Trait implementing functionality common to requests and responses.

Namespace

GuzzleHttp\Psr7

Code

private function trimHeaderValues(array $values) {
  return array_map(function ($value) {
    if (!is_scalar($value) && null !== $value) {
      throw new \InvalidArgumentException(sprintf('Header value must be scalar or null but %s provided.', is_object($value) ? get_class($value) : gettype($value)));
    }
    return trim((string) $value, " \t");
  }, $values);
}