public function EntityEnclosingRequest::setState

Set the state of the request

Parameters

string $state State of the request (complete, sending, or new):

array $context Contextual information about the state change:

Return value

RequestInterface

Overrides Request::setState

File

drupal/core/vendor/guzzle/http/Guzzle/Http/Message/EntityEnclosingRequest.php, line 64

Class

EntityEnclosingRequest
HTTP request that sends an entity-body in the request message (POST, PUT, PATCH, DELETE)

Namespace

Guzzle\Http\Message

Code

public function setState($state, array $context = array()) {
  parent::setState($state, $context);
  if ($state == self::STATE_TRANSFER && !$this->body && !count($this->postFields) && !count($this->postFiles)) {
    $this
      ->setHeader('Content-Length', 0)
      ->removeHeader('Transfer-Encoding');
  }
  return $this;
}