Skip to content

Commit 7d342e7

Browse files
authored
chore: Update test harness to v2 (#66)
1 parent 7c65c4b commit 7d342e7

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ start-contract-test-service-bg:
1111
@make start-contract-test-service >$(TEMP_TEST_OUTPUT) 2>&1 &
1212

1313
run-contract-tests:
14-
@curl -s https://raw.githubusercontent.com/launchdarkly/sse-contract-tests/v1.0.0/downloader/run.sh \
15-
| VERSION=v1 PARAMS="-url http://localhost:8000 -debug -stop-service-at-end" sh
14+
@curl -s https://raw.githubusercontent.com/launchdarkly/sse-contract-tests/v2.0.0/downloader/run.sh \
15+
| VERSION=v2 PARAMS="-url http://localhost:8000 -debug -stop-service-at-end" sh
1616

1717
contract-tests: build-contract-tests start-contract-test-service-bg run-contract-tests
1818

lib/ld-eventsource/client.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ def initialize(uri,
134134
end
135135

136136
@http_client = HTTP::Client.new(http_client_options)
137+
.follow
137138
.timeout({
138139
read: read_timeout,
139140
connect: connect_timeout,

lib/ld-eventsource/impl/event_parser.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,14 @@ def items
4242

4343
pos += 1 # skip colon
4444
pos += 1 if pos < line.length && line[pos] == ' ' # skip optional single space, per SSE spec
45-
line = line.slice(pos..-1)
45+
value = line.slice(pos..-1)
4646

47-
item = process_field(name, line)
47+
item = process_field(name, value)
48+
gen.yield item unless item.nil?
49+
else
50+
# Handle field with no colon - treat as having empty value
51+
# According to SSE spec, a line like "data" should be treated as "data:"
52+
item = process_field(line, "")
4853
gen.yield item unless item.nil?
4954
end
5055
end

0 commit comments

Comments
 (0)