From 005584628a7d5ad5a081ca7ffdd064e142e41ba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Fri, 29 Oct 2021 11:24:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ClientAbstracts.php | 12 +++++++++++- src/Curl.php | 2 -- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/ClientAbstracts.php b/src/ClientAbstracts.php index 24c4732..fe07507 100644 --- a/src/ClientAbstracts.php +++ b/src/ClientAbstracts.php @@ -5,9 +5,9 @@ namespace Http\Client; use Closure; -use Kiri\Context; use Http\Message\Stream; use JetBrains\PhpStorm\Pure; +use Kiri\Context; use Kiri\Core\Help; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; @@ -203,6 +203,16 @@ abstract class ClientAbstracts implements IClient return $this->header; } + + /** + * @return mixed|null + */ + public function getContentType(): ?string + { + return $this->header['Content-Type'] ?? $this->header['content-type'] ?? null; + } + + /** * @param array $header * @return ClientAbstracts diff --git a/src/Curl.php b/src/Curl.php index feda64f..4ba4730 100644 --- a/src/Curl.php +++ b/src/Curl.php @@ -61,8 +61,6 @@ class Curl extends ClientAbstracts return $resource; } - var_dump($contents, $params); - if (!empty($contents)) { curl_setopt($resource, CURLOPT_POSTFIELDS, $contents); } else if ($method === self::POST) {