Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions lib/ld-eventsource/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ def initialize(uri,
end

@http_client = HTTP::Client.new(http_client_options)
.follow
.timeout({
read: read_timeout,
connect: connect_timeout,
Expand Down
9 changes: 7 additions & 2 deletions lib/ld-eventsource/impl/event_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down