summaryrefslogtreecommitdiff
path: root/test/xmlrpc
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-06 22:45:43 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-06 22:45:43 +0000
commit9e9264c8d55b63e1033ed1a415ca9280744cf446 (patch)
tree7d81b9b7e1bdf99d00c95e4f4a56ee9d3e711985 /test/xmlrpc
parent8029539d029fc36ff8d09cc88ce821c7b4c6035f (diff)
* lib/xmlrpc/client.rb: assume servers that do not send a Content-Type
header are sending 'text/xml'. Thanks Nathan Leavitt! [ruby-core:41204] [Bug #5660] * test/xmlrpc/test_client.rb: supporting test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34935 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/xmlrpc')
-rw-r--r--test/xmlrpc/test_client.rb25
1 files changed, 24 insertions, 1 deletions
diff --git a/test/xmlrpc/test_client.rb b/test/xmlrpc/test_client.rb
index a509aec..d0e47b1 100644
--- a/test/xmlrpc/test_client.rb
+++ b/test/xmlrpc/test_client.rb
@@ -188,7 +188,7 @@ module XMLRPC
rest.each { |x| refute x }
end
- def test_bad_content_type
+ def test_request
fh = read 'blog.xml'
responses = {
@@ -210,6 +210,29 @@ module XMLRPC
assert_equal expected, resp
end
+ # make a request without content-type header
+ def test_bad_content_type
+ fh = read 'blog.xml'
+
+ responses = {
+ '/foo' => [ Fake::Response.new(fh) ]
+ }
+
+ client = fake_client(responses).new2 'http://example.org/foo'
+
+ resp = client.call('wp.getUsersBlogs', 'tlo', 'omg')
+
+ expected = [{
+ "isAdmin" => true,
+ "url" => "http://tenderlovemaking.com/",
+ "blogid" => "1",
+ "blogName" => "Tender Lovemaking",
+ "xmlrpc" => "http://tenderlovemaking.com/xmlrpc.php"
+ }]
+
+ assert_equal expected, resp
+ end
+
private
def read filename
File.read File.expand_path(File.join(__FILE__, '..', 'data', filename))