From ce5c3c016959e795d60fa1951bc8d435efe59823 Mon Sep 17 00:00:00 2001 From: Matthew Keeler Date: Mon, 18 Aug 2025 11:41:52 -0400 Subject: [PATCH 1/3] Fix "field with no colon" test --- lib/ld-eventsource/impl/event_parser.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/ld-eventsource/impl/event_parser.rb b/lib/ld-eventsource/impl/event_parser.rb index b766aeb..e73dadc 100644 --- a/lib/ld-eventsource/impl/event_parser.rb +++ b/lib/ld-eventsource/impl/event_parser.rb @@ -42,9 +42,14 @@ def items pos += 1 # skip colon pos += 1 if pos < line.length && line[pos] == ' ' # skip optional single space, per SSE spec - line = line.slice(pos..-1) + value = line.slice(pos..-1) - item = process_field(name, line) + item = process_field(name, value) + gen.yield item unless item.nil? + else + # Handle field with no colon - treat as having empty value + # According to SSE spec, a line like "data" should be treated as "data:" + item = process_field(line, "") gen.yield item unless item.nil? end end From 4899e8618162ef9aa645a830178653861d89e93c Mon Sep 17 00:00:00 2001 From: Matthew Keeler Date: Mon, 18 Aug 2025 11:43:00 -0400 Subject: [PATCH 2/3] Fix redirect behavior --- lib/ld-eventsource/client.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ld-eventsource/client.rb b/lib/ld-eventsource/client.rb index 8c80aee..328c8cf 100644 --- a/lib/ld-eventsource/client.rb +++ b/lib/ld-eventsource/client.rb @@ -134,6 +134,7 @@ def initialize(uri, end @http_client = HTTP::Client.new(http_client_options) + .follow .timeout({ read: read_timeout, connect: connect_timeout, From 87971ca455b1f72fb64821966da27a2453ebe15d Mon Sep 17 00:00:00 2001 From: Matthew Keeler Date: Mon, 18 Aug 2025 11:43:17 -0400 Subject: [PATCH 3/3] Update to v2 of contract tests --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 27c23d0..da3036e 100644 --- a/Makefile +++ b/Makefile @@ -11,8 +11,8 @@ start-contract-test-service-bg: @make start-contract-test-service >$(TEMP_TEST_OUTPUT) 2>&1 & run-contract-tests: - @curl -s https://raw.githubusercontent.com/launchdarkly/sse-contract-tests/v1.0.0/downloader/run.sh \ - | VERSION=v1 PARAMS="-url http://localhost:8000 -debug -stop-service-at-end" sh + @curl -s https://raw.githubusercontent.com/launchdarkly/sse-contract-tests/v2.0.0/downloader/run.sh \ + | VERSION=v2 PARAMS="-url http://localhost:8000 -debug -stop-service-at-end" sh contract-tests: build-contract-tests start-contract-test-service-bg run-contract-tests