We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f82c135 commit 1d4c42bCopy full SHA for 1d4c42b
lib/ld-eventsource/impl/event_parser.rb
@@ -37,11 +37,12 @@ def items
37
event = maybe_create_event
38
reset_buffers
39
gen.yield event if !event.nil?
40
- elsif (colon = line.index(':'))
41
- name = line.slice(0...colon)
+ elsif (pos = line.index(':'))
+ name = line.slice(0...pos)
42
43
- # delete the colon followed by an optional space
44
- line = line.slice(colon...).delete_prefix(':').delete_prefix(" ")
+ pos += 1 # skip colon
+ pos += 1 if pos < line.length && line[pos] == ' ' # skip optional single space, per SSE spec
45
+ line = line.slice(pos..-1)
46
47
item = process_field(name, line)
48
gen.yield item if !item.nil?
0 commit comments