File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -526,8 +526,12 @@ def do_rpc(request, async=false)
526526 end
527527 end
528528
529+ if data . nil?
530+ raise "No data"
531+ end
532+
529533 expected = resp [ "Content-Length" ] || "<unknown>"
530- if data . nil? or data . bytesize == 0
534+ if data . bytesize == 0
531535 raise "Wrong size. Was #{ data . bytesize } , should be #{ expected } "
532536 end
533537
Original file line number Diff line number Diff line change @@ -299,6 +299,18 @@ def test_bad_content_type
299299 assert_equal expected , resp
300300 end
301301
302+ def test_no_data
303+ responses = {
304+ '/foo' => [ Fake ::Response . new ( nil , [ [ 'Content-Type' , 'text/xml' ] ] ) ]
305+ }
306+
307+ client = fake_client ( responses ) . new2 'http://example.org/foo'
308+
309+ assert_raise ( RuntimeError . new ( "No data" ) ) do
310+ client . call ( 'wp.getUsersBlogs' , 'tlo' , 'omg' )
311+ end
312+ end
313+
302314 def test_i8_tag
303315 fh = read ( 'blog.xml' ) . gsub ( /string/ , 'i8' )
304316
You can’t perform that action at this time.
0 commit comments