Skip to content

Commit

Permalink
Handle upper or lowercase HTTP Content-Type header
Browse files Browse the repository at this point in the history
Fixes #16
  • Loading branch information
tjarratt committed Apr 10, 2015
1 parent 8eaf84c commit c346baf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/savon/multipart/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def xml

private
def multipart?
!(http.headers['content-type'] =~ /^multipart/).nil?
!(http.headers['content-type'] =~ /^multipart/im).nil?
end

def boundary
Expand Down
9 changes: 9 additions & 0 deletions spec/savon/soap/response_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ def soap_response(options = {})
end
end

describe "a multipart response with case sensitive headers" do
let(:header) {{ "Content-Type" => 'MuLtIpArT/rElAtEd; boundary="--==_mimepart_4d416ae62fd32_201a8043814c4724"; charset=UTF-8; type="text/xml"' }}
let(:path) { File.expand_path('../../../fixtures/response/simple_multipart.txt', __FILE__) }

it "does not care about upper or lowercase values for ContentType" do
expect(response.body).to eq({:submit_req => true})
end
end

context "not multipart" do
let(:path) { File.expand_path('../../../fixtures/response/not_multipart.txt', __FILE__) }
let(:header) { { 'Content-Type' => 'text/html; charset=utf-8'} }
Expand Down

0 comments on commit c346baf

Please sign in to comment.