You are here

public function RestfulBase::addHttpHeaders in RESTful 7

Add the a value to a multi-value HTTP header.

Parameters

string $key: The HTTP header key.

string $value: The HTTP header value.

Overrides RestfulInterface::addHttpHeaders

1 call to RestfulBase::addHttpHeaders()
RestfulEntityBase::getEntityIdByFieldId in plugins/restful/RestfulEntityBase.php
Get the entity ID based on the ID provided in the request.

File

plugins/restful/RestfulBase.php, line 358
Contains RestfulBase.

Class

RestfulBase
Class \RestfulBase

Code

public function addHttpHeaders($key, $value) {
  $headers = $this
    ->getHttpHeaders();

  // Add a value to the (potentially) existing header.
  $values = array();
  if (!empty($headers[$key])) {
    $values[] = $headers[$key];
  }
  $values[] = $value;
  $header = implode(', ', $values);
  $this
    ->setHttpHeaders($key, $header);
}