Permalink
Browse files

Allow passing in headers to requests using symbols (or anything that …

…responds to #to_s
  • Loading branch information...
1 parent a6e480a commit 18fc15e8dd13ca15e6cfb894eb733a2302e83f2f @carllerche carllerche committed Feb 23, 2011
Showing with 3 additions and 2 deletions.
  1. +1 −1 lib/kirk/client/exchange.rb
  2. +2 −1 spec/kirk/client_spec.rb
View
2 lib/kirk/client/exchange.rb
@@ -11,7 +11,7 @@ def self.from_request(req)
if req.headers
req.headers.each do |name, val|
- inst.set_request_header(name, val)
+ inst.set_request_header(name.to_s, val.to_s)
end
end
View
3 spec/kirk/client_spec.rb
@@ -29,7 +29,7 @@ def on_response_complete(response)
r.method :post
r.url "/foo"
r.handler handler.new(@buffer)
- r.headers "Accept" => "text/plain"
+ r.headers "Accept" => "text/plain", :Bizz => :bazz
r.body body
end
end
@@ -38,6 +38,7 @@ def on_response_complete(response)
response["PATH_INFO"].should == "/foo"
response["HTTP_ACCEPT"].should == "text/plain"
response["REQUEST_METHOD"].should == "POST"
+ response["HTTP_BIZZ"].should == "bazz"
response["rack.input"].should == "foobar"
@buffer.should == group.responses
end

0 comments on commit 18fc15e

Please sign in to comment.