mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/xmlrpc/client.rb (module XMLRPC): fix typo.
* test/xmlrpc/test_client.rb (test_async_call): add test for XMLRPC::Client#call_async to check above fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
075d98c7dc
commit
0c8ae91651
3 changed files with 41 additions and 2 deletions
|
@ -1,3 +1,10 @@
|
|||
Wed Mar 7 22:41:50 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
|
||||
|
||||
* lib/xmlrpc/client.rb (module XMLRPC): fix typo.
|
||||
|
||||
* test/xmlrpc/test_client.rb (test_async_call): add test for
|
||||
XMLRPC::Client#call_async to check above fix.
|
||||
|
||||
Wed Mar 7 16:30:24 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* error.c (rb_load_fail): should honor encoding.
|
||||
|
|
|
@ -526,7 +526,7 @@ module XMLRPC
|
|||
|
||||
if async
|
||||
# use a new HTTP object for each call
|
||||
http = net_http.new(@host, @port, @proxy_host, @proxy_port)
|
||||
http = net_http(@host, @port, @proxy_host, @proxy_port)
|
||||
http.use_ssl = @use_ssl if @use_ssl
|
||||
http.read_timeout = @timeout
|
||||
http.open_timeout = @timeout
|
||||
|
|
|
@ -16,7 +16,17 @@ module XMLRPC
|
|||
def started?
|
||||
@started
|
||||
end
|
||||
def start; @started = true; end
|
||||
def start
|
||||
@started = true
|
||||
if block_given?
|
||||
begin
|
||||
return yield(self)
|
||||
ensure
|
||||
@started = false
|
||||
end
|
||||
end
|
||||
self
|
||||
end
|
||||
|
||||
def request_post path, request, headers
|
||||
@responses[path].shift
|
||||
|
@ -210,6 +220,28 @@ module XMLRPC
|
|||
assert_equal expected, resp
|
||||
end
|
||||
|
||||
def test_async_request
|
||||
fh = read 'blog.xml'
|
||||
|
||||
responses = {
|
||||
'/foo' => [ Fake::Response.new(fh, [['Content-Type', 'text/xml']]) ]
|
||||
}
|
||||
|
||||
client = fake_client(responses).new2 'http://example.org/foo'
|
||||
|
||||
resp = client.call_async('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
|
||||
|
||||
# make a request without content-type header
|
||||
def test_bad_content_type
|
||||
fh = read 'blog.xml'
|
||||
|
|
Loading…
Reference in a new issue