Skip to content

Commit 6abbd12

Browse files
committed
added logic to output mime type
1 parent 0b40132 commit 6abbd12

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Flux/flxFmtJSON.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ template <std::size_t BUFFER_SIZE> class flxFormatJSON : public flxOutputFormat
3838

3939
public:
4040
//-----------------------------------------------------------------
41-
flxFormatJSON() : buffer_size{BUFFER_SIZE} {};
41+
flxFormatJSON() : buffer_size{BUFFER_SIZE}, _isFirstRun{true} {};
4242

4343
//-----------------------------------------------------------------
4444
// value methods
@@ -191,6 +191,12 @@ template <std::size_t BUFFER_SIZE> class flxFormatJSON : public flxOutputFormat
191191
szBuffer[buffer_size] = '\0';
192192
}
193193

194+
// dump out mime type
195+
if (_isFirstRun)
196+
{
197+
outputObservation("Content-Type: application/json", flxLineTypeMime);
198+
_isFirstRun = false;
199+
}
194200
// Send the JSON string to output writers/destinations
195201
outputObservation(szBuffer);
196202

@@ -282,4 +288,6 @@ template <std::size_t BUFFER_SIZE> class flxFormatJSON : public flxOutputFormat
282288

283289
private:
284290
std::vector<flxIWriterJSON *> _jsonWriters;
291+
292+
bool _isFirstRun;
285293
};

0 commit comments

Comments
 (0)