From c49a7251ed7b0fc80c7806b72bd98176a6c530f7 Mon Sep 17 00:00:00 2001 From: frank chen Date: Thu, 2 Dec 2021 13:25:17 +0800 Subject: [PATCH] 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;