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 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, 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