lib/net/ajp13/client.rb in ruby-ajp-0.2.0 vs lib/net/ajp13/client.rb in ruby-ajp-0.2.1
- old
+ new
@@ -3,17 +3,17 @@
# Client-side library for AJP1.3
#
# ==Example
#
# === Simple GET
-# require 'net/ajp13client'
+# require 'net/ajp13/client'
# Net::AJP13::Client.start('localhost') do |client|
# puts client.get('/index.jsp').body
# end
#
# === More about GET
-# require 'net/ajp13client'
+# require 'net/ajp13/client'
# req = Net::AJP13::GetRequest.new('/index.jsp')
# req.server_port = 80
# req['Host'] = 'www.example.com'
# res = Net::AJP13::Client.start('localhost') do |client|
# client.request(req) do |frag|
@@ -353,9 +353,18 @@
end
# Equals #request(GetRequest.new(+path+, +header+)) in this version.
def get(path, header = nil, &block)
request(Net::AJP13::GetRequest.new(path, header), &block)
+ end
+
+ def post(path, body, header = nil, &block)
+ post = Net::AJP13::PostRequest.new(path, header)
+ if body.respond_to?(:read)
+ post.body_stream = body
+ else
+ post.body = body
+ end
end
end