Skip to content

Commit

Permalink
Use a LowercaseHash when :headers_hash is passed to a response.
Browse files Browse the repository at this point in the history
  • Loading branch information
myronmarston committed Nov 4, 2010
1 parent 490be4b commit a5b532d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/typhoeus/response.rb
Expand Up @@ -18,7 +18,7 @@ def initialize(params = {})
@request = params[:request]
@effective_url = params[:effective_url]
@mock = params[:mock] || false # default
@headers_hash = params[:headers_hash]
@headers_hash = LowercaseHash.new(params[:headers_hash]) if params[:headers_hash]
end

# Returns true if this is a mock response.
Expand Down
5 changes: 5 additions & 0 deletions spec/typhoeus/response_spec.rb
Expand Up @@ -7,6 +7,11 @@
response.headers_hash.should == {}
end

it "allows header access using a different casing of the header key" do
response = Typhoeus::Response.new(:headers_hash => { 'content-type' => 'text/html' } )
response.headers_hash['Content-Type'].should == 'text/html'
end

it "should store response_code" do
Typhoeus::Response.new(:code => 200).code.should == 200
end
Expand Down

0 comments on commit a5b532d

Please sign in to comment.