src/Http.php
protected function makeTransportRequest($method, $url, $data = null, array $headers = array(), $timeout = null)
	{
		// Look for headers set in the options.
		if (isset($this->options['headers']))
		{
			$temp = (array) $this->options['headers'];

			foreach ($temp as $key => $val)
			{
				if (!isset($headers[$key]))
				{
					$headers[$key] = $val;
				}
			}
		}

		// Look for timeout set in the options.
		if ($timeout === null && isset($this->options['timeout']))
		{
			$timeout = $this->options['timeout'];
		}

		$userAgent = isset($this->options['userAgent']) ? $this->options['userAgent'] : null;

		// Convert to a Uri object if we were given a string
		if (\is_string($url))
		{
			$url = new Uri($url);
		}
		elseif (!($url instanceof UriInterface))
		{
			throw new \InvalidArgumentException(sprintf('A string or UriInterface object must be provided, a "%s" was provided.', \gettype($url)));
		}

		return $this->transport->request($method, $url, $data, $headers, $timeout, $userAgent);
	}
protected function makeTransportRequest($method, $url, $data = null, array $headers = array(), $timeout = null)
	{
		// Look for headers set in the options.
		if (isset($this->options['headers']))
		{
			$temp = (array) $this->options['headers'];

			foreach ($temp as $key => $val)
			{
				if (!isset($headers[$key]))
				{
					$headers[$key] = $val;
				}
			}
		}

		// Look for timeout set in the options.
		if ($timeout === null && isset($this->options['timeout']))
		{
			$timeout = $this->options['timeout'];
		}

		$userAgent = isset($this->options['userAgent']) ? $this->options['userAgent'] : null;

		// Convert to a Uri object if we were given a string
		if (\is_string($url))
		{
			$url = new Uri($url);
		}
		elseif (!($url instanceof UriInterface))
		{
			throw new \InvalidArgumentException(sprintf('A string or UriInterface object must be provided, a "%s" was provided.', \gettype($url)));
		}

		return $this->transport->request($method, $url, $data, $headers, $timeout, $userAgent);
	}
Send a request to the server and return a Response object with the response.

@param   string               $method   The HTTP method for sending the request.
@param   string|UriInterface  $url      The URI to the resource to request.
@param   mixed                $data     Either an associative array or a string to be sent with the request.
@param   array                $headers  An array of request headers to send with the request.
@param   integer              $timeout  Read timeout in seconds.

@return  Response

@since   1.0
@throws  \InvalidArgumentException