Skip to content
Open
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
3 changes: 3 additions & 0 deletions lib/httpclient/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,9 @@ def get_body(&block)
close
end
end

@debug_dev << "\n" if @debug_dev

nil
end

Expand Down
9 changes: 9 additions & 0 deletions test/test_http-access2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ def test_debug_dev
assert(!str.empty?)
end

def test_debug_dev_shared_dev
str = "".dup
@client.debug_dev = str
@client.get(serverurl)
str << "another stuff\n"
lines = str.split(/(?:\r?\n)+/)
assert_equal('another stuff', lines[-1])
end

def _test_protocol_version_http09
@client.protocol_version = 'HTTP/0.9'
str = "".dup
Expand Down
24 changes: 24 additions & 0 deletions test/test_httpclient.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ def test_debug_dev
assert(!str.empty?)
end

def test_debug_dev_shared_dev
str = "".dup
@client.debug_dev = str
@client.get(serverurl + 'hello')

str << "another stuff\n"
lines = str.split(/(?:\r?\n)+/)

assert_equal('hello', lines[-2])
assert_equal('another stuff', lines[-1])
end

def test_debug_dev_stream
str = "".dup
@client.debug_dev = str
Expand All @@ -65,6 +77,18 @@ def test_debug_dev_stream
assert(!str.empty?)
end

def test_debug_dev_stream_shared_dev
str = "".dup
@client.debug_dev = str
conn = @client.get_async(serverurl)
Thread.pass while !conn.finished?

str << "another stuff\n"
lines = str.split(/(?:\r?\n)+/)

assert_equal('another stuff', lines[-1])
end

def test_protocol_version_http09
@client.protocol_version = 'HTTP/0.9'
@client.debug_dev = str = ''.dup
Expand Down