From 3021716b1378ce47d6bba55b766fb898a67823d7 Mon Sep 17 00:00:00 2001 From: Godruoyi Date: Thu, 2 Jan 2025 18:13:58 +0800 Subject: [PATCH] Feat: do not override default headers when fire a json-type request --- src/Support/Http.php | 2 +- src/Support/Logger.php | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Support/Http.php b/src/Support/Http.php index 227bf3b..b6921c8 100644 --- a/src/Support/Http.php +++ b/src/Support/Http.php @@ -133,7 +133,7 @@ public function json($url, $data = [], $queries = [], array $options = [], $enco { is_array($data) && $data = json_encode($data, $encodeOption); - $this->setHeaders(['Content-Type' => 'application/json']); + $options = array_merge(['headers' => ['Content-Type' => 'application/json']], $options); return $this->request('POST', $url, array_merge([ 'query' => $queries, diff --git a/src/Support/Logger.php b/src/Support/Logger.php index 766139b..a556cb0 100644 --- a/src/Support/Logger.php +++ b/src/Support/Logger.php @@ -10,8 +10,6 @@ namespace Godruoyi\OCR\Support; -use function implode; - use Monolog\Formatter\LineFormatter; use Monolog\Handler\ErrorLogHandler; use Monolog\Handler\HandlerInterface; @@ -22,6 +20,7 @@ use Monolog\Logger as Monolog; use Psr\Log\LoggerInterface; +use function implode; use function sprintf; class Logger implements LoggerInterface