protected function applyMethod(string
$method, array
$curlOptions): array
{ $method =
strtoupper($method);
$this->method =
$method;
$curlOptions[CURLOPT_CUSTOMREQUEST
] =
$method;
$size =
strlen($this->body ?? ''
);
// Have content?
if ($size > 0
) { return $this->
applyBody($curlOptions);
} if ($method === 'PUT' ||
$method === 'POST'
) { // See http://tools.ietf.org/html/rfc7230#section-3.3.2
if ($this->
header('content-length'
) === null && !
isset($this->config
['multipart'
])) { $this->
setHeader('Content-Length', '0'
);
} } elseif ($method === 'HEAD'
) { $curlOptions[CURLOPT_NOBODY
] = 1;
}