protected function createHeaders(RequestInterface $request, array $options)
	{
		$headers = [];
		$body = $request->getBody();
		$size = $body->getSize();

		foreach ($request->getHeaders() as $header => $values)
		{
			foreach ((array) $values as $value)
			{
				$headers[] = sprintf('%s: %s', $header, $value);
			}
		}

		if ( ! $request->hasHeader('Transfer-Encoding') && $size === null)
		{
			$headers[] = 'Transfer-Encoding: chunked';
		}

		if ( ! $request->hasHeader('Expect') && in_array($request->getMethod(), ['POST', 'PUT']))
		{
			if ($request->getProtocolVersion() < 2.0 && ! $body->isSeekable() || $size === null || $size > 1048576)
			{
				$headers[] = 'Expect: 100-Continue';
			}
			else
			{
				$headers[] = 'Expect: ';
			}
		}

		return $headers;
	}
protected function createHeaders(RequestInterface $request, array $options)
	{
		$headers = [];
		$body = $request->getBody();
		$size = $body->getSize();

		foreach ($request->getHeaders() as $header => $values)
		{
			foreach ((array) $values as $value)
			{
				$headers[] = sprintf('%s: %s', $header, $value);
			}
		}

		if ( ! $request->hasHeader('Transfer-Encoding') && $size === null)
		{
			$headers[] = 'Transfer-Encoding: chunked';
		}

		if ( ! $request->hasHeader('Expect') && in_array($request->getMethod(), ['POST', 'PUT']))
		{
			if ($request->getProtocolVersion() < 2.0 && ! $body->isSeekable() || $size === null || $size > 1048576)
			{
				$headers[] = 'Expect: 100-Continue';
			}
			else
			{
				$headers[] = 'Expect: ';
			}
		}

		return $headers;
	}
protected function createHeaders ( RequestInterface $ request , array $ options ) { $ headers = [ ] ; $ body = $ request -> getBody ( ) ; $ size = $ body -> getSize ( ) ; foreach ( $ request -> getHeaders ( ) as $ header => $ values ) { foreach ( ( array ) $ values as $ value ) { $ headers [ ] = sprintf ( '%s: %s' , $ header , $ value ) ; } } if ( ! $ request -> hasHeader ( 'Transfer-Encoding' ) && $ size === null ) { $ headers [ ] = 'Transfer-Encoding: chunked' ; } if ( ! $ request -> hasHeader ( 'Expect' ) && in_array ( $ request -> getMethod ( ) , [ 'POST' , 'PUT' ] ) ) { if ( $ request -> getProtocolVersion ( ) < 2.0 && ! $ body -> isSeekable ( ) || $ size === null || $ size > 1048576 ) { $ headers [ ] = 'Expect: 100-Continue' ; } else { $ headers [ ] = 'Expect: ' ; } } return $ headers ; }
Create headers array for CURLOPT_HTTPHEADER

@param RequestInterface $request
@param array $options cURL options

@return string[]
Create headers array for CURLOPT_HTTPHEADER