Add note on excluding content-length header from DELETE requests

This commit is contained in:
Zach Borboa
2018-11-29 23:48:18 -08:00
parent 9edf5116a2
commit 20707b600f
+8
View File
@@ -265,6 +265,14 @@ class Curl
$this->setUrl($url, $query_parameters);
$this->setOpt(CURLOPT_CUSTOMREQUEST, 'DELETE');
// Avoid including a content-length header in DELETE requests unless there is a message body. The following
// would include "Content-Length: 0" in the request header:
// curl_setopt($ch, CURLOPT_POSTFIELDS, array());
// RFC 2616 4.3 Message Body:
// The presence of a message-body in a request is signaled by the
// inclusion of a Content-Length or Transfer-Encoding header field in
// the request's message-headers.
if (!empty($data)) {
$this->setOpt(CURLOPT_POSTFIELDS, $this->buildPostData($data));
}