mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-31 12:43:14 +00:00
Add note on excluding content-length header from DELETE requests
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user