add clear

This commit is contained in:
2020-11-25 18:25:22 +08:00
parent 41393ef343
commit 6fd5e530fb
+4 -13
View File
@@ -681,22 +681,13 @@ class HttpClient
curl_setopt($ch, CURLOPT_POST, 1);
}
if ($this->method != self::GET && !empty($this->_data)) {
$this->_data = $this->mergeParams($data);
} else {
$this->_data = $this->mergeParams($data);
}
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, strtoupper($this->method));
if (!is_string($this->_data)) {
$message = $this->header['Content-Type'] ?? $this->header['content-type'] ?? 'application/json';
if ($message == 'application/json') {
$this->_data = json_encode($this->_data, JSON_UNESCAPED_UNICODE);
} else {
$this->_data = http_build_query($this->_data);
if ($this->method === self::GET && !empty($this->_data)) {
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->toRequest($data));
}
if ($this->method === self::POST) {
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->mergeParams($data));
}
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->_data);
$output = curl_exec($ch);
if ($output === false) {