Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nginx-push-stream-module
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
nginx-push-stream-module
Commits
31c5d1b6
Commit
31c5d1b6
authored
Aug 18, 2011
by
Wandenberg Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix compare between headers only with the same size
parent
5af7370d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
+45
-0
test_publish_messages.rb
test/test_publish_messages.rb
+45
-0
No files found.
test/test_publish_messages.rb
View file @
31c5d1b6
...
...
@@ -154,4 +154,49 @@ class TestPublishMessages < Test::Unit::TestCase
}
end
def
config_test_ignore_event_id_header_parameter_with_not_match_exactly
@header_template
=
nil
@message_template
=
'{\"id\": \"~id~\", \"channel\": \"~channel~\", \"text\": \"~text~\", \"event_id\": \"~event-id~\"}'
end
def
test_ignore_event_id_header_parameter_with_not_match_exactly
event_id
=
'event_id_with_generic_text_01'
headers
=
{
'accept'
=>
'text/html'
}
body
=
'test message'
channel
=
'ch_test_set_an_event_id_to_the_message_through_header_parameter'
response
=
''
EventMachine
.
run
{
sub
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/sub/'
+
channel
.
to_s
).
get
sub
.
stream
{
|
chunk
|
response
=
JSON
.
parse
(
chunk
)
assert_equal
(
1
,
response
[
"id"
].
to_i
,
"Wrong data received"
)
assert_equal
(
channel
,
response
[
"channel"
],
"Wrong data received"
)
assert_equal
(
body
,
response
[
"text"
],
"Wrong data received"
)
assert_equal
(
""
,
response
[
"event_id"
],
"Wrong data received"
)
EventMachine
.
stop
}
pub
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/pub?id='
+
channel
.
to_s
).
post
:head
=>
headers
.
merge
(
'Event-Ids'
=>
event_id
),
:body
=>
body
,
:timeout
=>
30
add_test_timeout
}
EventMachine
.
run
{
sub
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/sub/'
+
channel
.
to_s
).
get
sub
.
stream
{
|
chunk
|
response
=
JSON
.
parse
(
chunk
)
assert_equal
(
2
,
response
[
"id"
].
to_i
,
"Wrong data received"
)
assert_equal
(
channel
,
response
[
"channel"
],
"Wrong data received"
)
assert_equal
(
body
,
response
[
"text"
],
"Wrong data received"
)
assert_equal
(
""
,
response
[
"event_id"
],
"Wrong data received"
)
EventMachine
.
stop
}
pub
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/pub?id='
+
channel
.
to_s
).
post
:head
=>
headers
.
merge
(
'Event-I'
=>
event_id
),
:body
=>
body
,
:timeout
=>
30
add_test_timeout
}
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment