From 7be0b9724a259a0ad863963d8db73b5b7e4c6f08 Mon Sep 17 00:00:00 2001 From: Kanwardeep Date: Mon, 7 Apr 2025 12:54:20 +0100 Subject: [PATCH] chore: tests for jsonl --- cmd/server/main.go | 1 + internal/jsonLines/service.go | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/cmd/server/main.go b/cmd/server/main.go index f083cae..715dad4 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -66,6 +66,7 @@ func main() { r.HandleFunc("/eventstreams/differentdataschemas", eventstreams.HandleEventStreamDifferentDataSchemas).Methods(http.MethodPost) r.HandleFunc("/eventstreams/differentdataschemas-flat", eventstreams.HandleEventStreamDifferentDataSchemasFlatten).Methods(http.MethodPost) r.HandleFunc("/jsonl", jsonLines.HandleJSONLinesRich).Methods(http.MethodGet) + r.HandleFunc("/jsonl/deserialization_verification", jsonLines.HandleJsonLinesDeserializationVerification).Methods(http.MethodGet) r.HandleFunc("/jsonl/chunks", jsonLines.HandleJSONLinesChunksRich).Methods(http.MethodGet) r.HandleFunc("/x-ndjson", xNdJson.HandleXNdJsonLinesRich).Methods(http.MethodGet) r.HandleFunc("/x-ndjson/chunks", xNdJson.HandleXNdJsonLinesChunksRich).Methods(http.MethodGet) diff --git a/internal/jsonLines/service.go b/internal/jsonLines/service.go index 8bc5e74..751b12d 100644 --- a/internal/jsonLines/service.go +++ b/internal/jsonLines/service.go @@ -54,3 +54,14 @@ func HandleJSONLinesRich(rw http.ResponseWriter, _ *http.Request) { }, }) } + +func HandleJsonLinesDeserializationVerification(rw http.ResponseWriter, _ *http.Request) { + rw.Header().Add("Content-Type", "application/jsonl") + + pushEvents(rw, [][]string{ + { + "{\"isFinished\": \"yes\"}\n", + }, + }) + +}