protected function addRequestBodyOptions(RequestInterface $request, array $options)
	{
		/*
		 * HTTP methods that cannot have payload:
		 * - GET   => cURL will automatically change method to PUT or POST if we
		 *            set CURLOPT_UPLOAD or CURLOPT_POSTFIELDS.
		 * - HEAD  => cURL treats HEAD as GET request with a same restrictions.
		 * - TRACE => According to RFC7231: a client MUST NOT send a message body
		 *            in a TRACE request.
		 */
		$http_methods = [
			'GET',
			'HEAD',
			'TRACE',
		];

		if (!in_array($request->getMethod(), $http_methods, true)) {
			$body      = $request->getBody();
			$body_size = $body->getSize();

			if ($body_size !== 0) {
				if ($body->isSeekable()) {
					$body->rewind();
				}

				if ($body_size === null || $body_size > self::$MAX_BODY_SIZE) {
					$options[CURLOPT_UPLOAD] = true;

					if ($body_size !== null) {
						$options[CURLOPT_INFILESIZE] = $body_size;
					}

					$options[CURLOPT_READFUNCTION] = function ($ch, $fd, $len) use ($body) {
						return $body->read($len);
					};
				}
				else {
					$options[CURLOPT_POSTFIELDS] = (string)$body;
				}
			}
		}

		if ($request->getMethod() === 'HEAD') {
			$options[CURLOPT_NOBODY] = true;
		}
		else if ($request->getMethod() !== 'GET') {
			$options[CURLOPT_CUSTOMREQUEST] = $request->getMethod();
		}

		return $options;
	}