Skip to content

Commit

Permalink
Allow to pass URI for a request
Browse files Browse the repository at this point in the history
  • Loading branch information
drogus committed Mar 7, 2011
1 parent b2b57c1 commit f48d4cd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/kirk/client/exchange.rb
Expand Up @@ -22,7 +22,7 @@ def prepare!(request)
self.request = request
self.response = Response.new(!handler.respond_to?(:on_response_body))
self.method = request.method
self.url = request.url
self.url = request.url.to_s

if request.headers
request.headers.each do |name, val|
Expand Down
7 changes: 7 additions & 0 deletions spec/client/client_spec.rb
Expand Up @@ -38,6 +38,13 @@
response["REQUEST_METHOD"].should == "DELETE"
end

it "does not freak out when URI is passed" do
response = Kirk::Client.get(URI.parse("http://localhost:9090/foo"))
response = parse_response(response)
response["PATH_INFO"].should == "/foo"
response["REQUEST_METHOD"].should == "GET"
end

it "allows to pass block for request" do
handler = Class.new do
def initialize(buffer)
Expand Down

0 comments on commit f48d4cd

Please sign in to comment.