Commit a8d35084 authored by Wandenberg Peixoto's avatar Wandenberg Peixoto

remove default header template for EventSource subscribers

parent 8bdfda09
...@@ -203,7 +203,7 @@ static const ngx_str_t NGX_HTTP_PUSH_STREAM_TOKEN_MESSAGE_TEXT = ngx_string("~t ...@@ -203,7 +203,7 @@ static const ngx_str_t NGX_HTTP_PUSH_STREAM_TOKEN_MESSAGE_TEXT = ngx_string("~t
static const ngx_str_t NGX_HTTP_PUSH_STREAM_TOKEN_MESSAGE_TAG = ngx_string("~tag~"); static const ngx_str_t NGX_HTTP_PUSH_STREAM_TOKEN_MESSAGE_TAG = ngx_string("~tag~");
static const ngx_str_t NGX_HTTP_PUSH_STREAM_TOKEN_MESSAGE_TIME = ngx_string("~time~"); static const ngx_str_t NGX_HTTP_PUSH_STREAM_TOKEN_MESSAGE_TIME = ngx_string("~time~");
static const ngx_str_t NGX_HTTP_PUSH_STREAM_EVENTSOURCE_DEFAULT_HEADER_TEMPLATE = ngx_string(":"); static const ngx_str_t NGX_HTTP_PUSH_STREAM_EVENTSOURCE_DEFAULT_HEADER_TEMPLATE = ngx_string("");
static const ngx_str_t NGX_HTTP_PUSH_STREAM_EVENTSOURCE_COMMENT_TEMPLATE = ngx_string(": ~text~\r\n"); static const ngx_str_t NGX_HTTP_PUSH_STREAM_EVENTSOURCE_COMMENT_TEMPLATE = ngx_string(": ~text~\r\n");
static const ngx_str_t NGX_HTTP_PUSH_STREAM_EVENTSOURCE_MESSAGE_PREFIX = ngx_string("data: "); static const ngx_str_t NGX_HTTP_PUSH_STREAM_EVENTSOURCE_MESSAGE_PREFIX = ngx_string("data: ");
static const ngx_str_t NGX_HTTP_PUSH_STREAM_EVENTSOURCE_ID_TEMPLATE = ngx_string("id: ~event-id~"); static const ngx_str_t NGX_HTTP_PUSH_STREAM_EVENTSOURCE_ID_TEMPLATE = ngx_string("id: ~event-id~");
......
...@@ -64,7 +64,7 @@ describe "Subscriber Event Source" do ...@@ -64,7 +64,7 @@ describe "Subscriber Event Source" do
response += chunk response += chunk
end end
sub.callback do sub.callback do
response.should eql(":\r\n: footer line 1\r\n: footer line 2\r\n: footer line 3\r\n: footer line 4\r\n\r\n") response.should eql(": footer line 1\r\n: footer line 2\r\n: footer line 3\r\n: footer line 4\r\n\r\n")
EventMachine.stop EventMachine.stop
end end
end end
...@@ -82,7 +82,7 @@ describe "Subscriber Event Source" do ...@@ -82,7 +82,7 @@ describe "Subscriber Event Source" do
response += chunk response += chunk
end end
sub.callback do sub.callback do
response.should eql(":\r\n: footer line 1\\nfooter line 2\r\n\r\n") response.should eql(": footer line 1\\nfooter line 2\r\n\r\n")
EventMachine.stop EventMachine.stop
end end
end end
...@@ -100,7 +100,7 @@ describe "Subscriber Event Source" do ...@@ -100,7 +100,7 @@ describe "Subscriber Event Source" do
sub.stream do |chunk| sub.stream do |chunk|
response += chunk response += chunk
if response.include?("\r\n\r\n") if response.include?("\r\n\r\n")
response.should eql(":\r\ndata: #{body}\r\n\r\n") response.should eql("data: #{body}\r\n\r\n")
EventMachine.stop EventMachine.stop
end end
end end
...@@ -121,7 +121,7 @@ describe "Subscriber Event Source" do ...@@ -121,7 +121,7 @@ describe "Subscriber Event Source" do
sub.stream do |chunk| sub.stream do |chunk|
response += chunk response += chunk
if response.include?("\r\n\r\n") if response.include?("\r\n\r\n")
response.should eql(":\r\ndata: #{body}\r\n\r\n") response.should eql("data: #{body}\r\n\r\n")
EventMachine.stop EventMachine.stop
end end
end end
...@@ -143,7 +143,7 @@ describe "Subscriber Event Source" do ...@@ -143,7 +143,7 @@ describe "Subscriber Event Source" do
sub.stream do |chunk| sub.stream do |chunk|
response += chunk response += chunk
if response.include?("\r\n\r\n") if response.include?("\r\n\r\n")
response.should eql(":\r\nid: #{event_id}\r\ndata: #{body}\r\n\r\n") response.should eql("id: #{event_id}\r\ndata: #{body}\r\n\r\n")
EventMachine.stop EventMachine.stop
end end
end end
...@@ -165,7 +165,7 @@ describe "Subscriber Event Source" do ...@@ -165,7 +165,7 @@ describe "Subscriber Event Source" do
sub.stream do |chunk| sub.stream do |chunk|
response += chunk response += chunk
if response.include?("\r\n\r\n") if response.include?("\r\n\r\n")
response.should eql(":\r\nevent: #{event_type}\r\ndata: #{body}\r\n\r\n") response.should eql("event: #{event_type}\r\ndata: #{body}\r\n\r\n")
EventMachine.stop EventMachine.stop
end end
end end
...@@ -186,7 +186,7 @@ describe "Subscriber Event Source" do ...@@ -186,7 +186,7 @@ describe "Subscriber Event Source" do
sub.stream do |chunk| sub.stream do |chunk|
response += chunk response += chunk
if response.include?("\r\n\r\n") if response.include?("\r\n\r\n")
response.should eql(%(:\r\ndata: {"id":"1", "message":"#{body}"}\r\n\r\n)) response.should eql(%(data: {"id":"1", "message":"#{body}"}\r\n\r\n))
EventMachine.stop EventMachine.stop
end end
end end
...@@ -207,7 +207,7 @@ describe "Subscriber Event Source" do ...@@ -207,7 +207,7 @@ describe "Subscriber Event Source" do
sub.stream do |chunk| sub.stream do |chunk|
response += chunk response += chunk
if response.include?("\r\n\r\n") if response.include?("\r\n\r\n")
response.should eql(%(:\r\ndata: {"id":"1", "message":"#{body}"}\r\n\r\n)) response.should eql(%(data: {"id":"1", "message":"#{body}"}\r\n\r\n))
EventMachine.stop EventMachine.stop
end end
end end
...@@ -229,7 +229,7 @@ describe "Subscriber Event Source" do ...@@ -229,7 +229,7 @@ describe "Subscriber Event Source" do
sub.stream do |chunk| sub.stream do |chunk|
response += chunk response += chunk
if response.include?("\r\n\r\n") if response.include?("\r\n\r\n")
response.should eql(%(:\r\nid: #{event_id}\r\ndata: {"id":"1", "message":"#{body}"}\r\n\r\n)) response.should eql(%(id: #{event_id}\r\ndata: {"id":"1", "message":"#{body}"}\r\n\r\n))
EventMachine.stop EventMachine.stop
end end
end end
...@@ -251,7 +251,7 @@ describe "Subscriber Event Source" do ...@@ -251,7 +251,7 @@ describe "Subscriber Event Source" do
sub.stream do |chunk| sub.stream do |chunk|
response += chunk response += chunk
if response.include?("\r\n\r\n") if response.include?("\r\n\r\n")
response.should eql(%(:\r\nevent: #{event_type}\r\ndata: {"id":"1", "message":"#{body}"}\r\n\r\n)) response.should eql(%(event: #{event_type}\r\ndata: {"id":"1", "message":"#{body}"}\r\n\r\n))
EventMachine.stop EventMachine.stop
end end
end end
...@@ -330,7 +330,7 @@ describe "Subscriber Event Source" do ...@@ -330,7 +330,7 @@ describe "Subscriber Event Source" do
sub.stream do |chunk| sub.stream do |chunk|
response += chunk response += chunk
if response.include?("msg 4") if response.include?("msg 4")
response.should eql(":\r\ndata: msg 3\r\n\r\nid: event 3\r\ndata: msg 4\r\n\r\n") response.should eql("data: msg 3\r\n\r\nid: event 3\r\ndata: msg 4\r\n\r\n")
EventMachine.stop EventMachine.stop
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment