Add a new header to the list if there is no value already set.

@param string $name  Name of the header
@param string $value Value of the header

@return $this
495130
public function addDefaultHeader($name, $value)
    {
        if (!isset($this->headers[$name])) {
            $this->headers[$name] = $value;
        }

        return $this;
    }
1019622
public function addRequestHeader($header, $value) {
        $this->request = $this->request->withAddedHeader($header, $value);

        return $this;
    }
811081
public function setHeader($name, $value)
    {
        if (!$this->response->headers->has($name)) {
            $this->response->headers->set($name, $value);
        }
    }
1024473
public function withAddedHeader($name, $value): self
    {
        $this->assertHeaderName($name);

        $clone = clone $this;
        $clone->headers->add($name, $value);

        return $clone;
    }
1219398
protected function setHeader($name, $value)
    {
        $name  = $this->prepareHeaderName($name);
        $value = $this->prepareHeaderValue($value);

        $normalized = strtolower($name);
        if (! isset($this->headerNames[$normalized])) {
            $this->headerNames[$normalized] = $name;
        }

        $header = $this->headerNames[$normalized];

        $this->rawHeaders[$header] = $value;

        return $this;
    }
651246
public function withAddedHeader($name, $value): self
    {
        $request = clone $this;
        $request->headers->set($name, $value, false);

        return $request;
    }
1168212
public function setHeader($name, $value)
    {
        $this->getResponse()->headers->set($name, $value);

        return $this;
    }
1001517
public function withHeader($name, $value) : self
    {
        $new = clone $this;

        return $new->setResponse($this->response->withHeader($name, $value));
    }
86220
public function addHeader(string $name, string $value) : self
    {
        $name = $this->normalizeHeader($name);
        if (isset($this->headers[$name])) {
            throw new \InvalidArgumentException(
                sprintf("Header %s is already set with value '%s'", $name, $this->headers[$name])
            );
        }

        $this->headers[$name] = $value;

        return $this;
    }
1166110
public function addOptionalHeader($name, $value)
    {
        Validate::isString($name, 'name');
        Validate::isString($value, 'value');

        if (!empty($value)) {
            $this->_headers[$name] = $value;
        }
    }
323187
public function withHeader($header, $value)
    {
        // Normalize the header names.
        $header = trim($header);
        $name   = strtolower($header);

        // Create a clone and set the given header in the clone.
        $new = clone $this;

        $new->headerNames[$name] = $header;
        $new->headers[$header]   = (array) $value;

        return $new;
    }
328348
public function add($name, $value)
    {
        $this->requireNames();
        $value = $this->normalizeValue($value);
        
        $lower = strtolower($name);
        if(array_key_exists($lower, $this->names)) {
            $name = $this->names[$lower];
            foreach($value as $line) {
                $this->headers[$name][] = $line;
            }
        }else{
            $this->setHeader($name, $value);
        }
    }
488912
public function AddCustomHeader($name, $value=null) {
	if ($value === null) {
		// Value passed in as name:value
		$this->CustomHeader[] = explode(':', $name, 2);
	} else {
		$this->CustomHeader[] = array($name, $value);
	}
  }
330340
final public function withAddedHeader($name, $value): self
    {
        return $this->withHeader($name, array_merge($this->getHeader($name), (array)$value));
    }
1093011
public function withAddedHeader($name, $value)
    {
        $instance = clone $this;
        $instance->headers->add($name, $value);
        return $instance;
    }
78035
public function header( string $name, string $value )
      : Request
   {

      if ( \is_null( $value ) || ! \is_string( $value ) )
      {
         unset( $this->_defaultHeaders[ $name ] );
      }

      $this->_defaultHeaders[ $name ] = $value;

      return $this;

   }
865785
public final function header(string $name, string $value = null)
    {
        return ($value === null) ? $this->getHeader($name) : $this->setHeader($name, $value);
    }