From c49a7251ed7b0fc80c7806b72bd98176a6c530f7 Mon Sep 17 00:00:00 2001 From: frank chen Date: Thu, 2 Dec 2021 13:25:17 +0800 Subject: [PATCH 1/2] returns content-type as json if possible Signed-off-by: frank chen --- src/Processors/Formats/Impl/JSONEachRowRowOutputFormat.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Processors/Formats/Impl/JSONEachRowRowOutputFormat.h b/src/Processors/Formats/Impl/JSONEachRowRowOutputFormat.h index 23fb506c220..12e1259d319 100644 --- a/src/Processors/Formats/Impl/JSONEachRowRowOutputFormat.h +++ b/src/Processors/Formats/Impl/JSONEachRowRowOutputFormat.h @@ -23,6 +23,13 @@ public: String getName() const override { return "JSONEachRowRowOutputFormat"; } +public: + /// Content-Type to set when sending HTTP response. + String getContentType() const override + { + return settings.json.array_of_rows ? "application/json; charset=UTF-8" : IRowOutputFormat::getContentType(); + } + protected: void writeField(const IColumn & column, const ISerialization & serialization, size_t row_num) override; void writeFieldDelimiter() override; From 6ec559f103998cbd81061fee0a24fd162794564e Mon Sep 17 00:00:00 2001 From: Maksim Kita Date: Fri, 3 Dec 2021 12:48:28 +0300 Subject: [PATCH 2/2] Update JSONEachRowRowOutputFormat.h --- src/Processors/Formats/Impl/JSONEachRowRowOutputFormat.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Processors/Formats/Impl/JSONEachRowRowOutputFormat.h b/src/Processors/Formats/Impl/JSONEachRowRowOutputFormat.h index 12e1259d319..147169b5e91 100644 --- a/src/Processors/Formats/Impl/JSONEachRowRowOutputFormat.h +++ b/src/Processors/Formats/Impl/JSONEachRowRowOutputFormat.h @@ -26,8 +26,8 @@ public: public: /// Content-Type to set when sending HTTP response. String getContentType() const override - { - return settings.json.array_of_rows ? "application/json; charset=UTF-8" : IRowOutputFormat::getContentType(); + { + return settings.json.array_of_rows ? "application/json; charset=UTF-8" : IRowOutputFormat::getContentType(); } protected: