1
0
Fork 0
mirror of https://github.com/rest-client/rest-client.git synced 2022-11-09 13:49:40 -05:00

Merge branch 'master' of github.com:archiloque/rest-client

This commit is contained in:
Julien Kirch 2011-11-02 18:31:35 +01:00
commit e4186c5980
3 changed files with 9 additions and 2 deletions

View file

@ -57,7 +57,7 @@ This does two things for you:
If you are sending params that do not contain a File object but the payload needs to be multipart then:
RestClient.post '/data', :foo => 'bar', :multipart => true
RestClient.post '/data', {:foo => 'bar', :multipart => true}
== Usage: ActiveResource-Style

View file

@ -87,7 +87,7 @@ module RestClient
def make_headers user_headers
unless @cookies.empty?
user_headers[:cookie] = @cookies.map { |(key, val)| "#{key.to_s}=#{CGI::unescape(val)}" }.sort.join('; ')
user_headers[:cookie] = @cookies.map { |(key, val)| "#{key.to_s}=#{CGI::unescape(val.to_s)}" }.sort.join('; ')
end
headers = stringify_headers(default_headers).merge(stringify_headers(user_headers))
headers.merge!(@payload.headers) if @payload

View file

@ -129,6 +129,13 @@ describe RestClient::Request do
headers.should have_key('1')
headers['1'].should == '3'
end
it "converts user headers to string before calling CGI::unescape which fails on non string values" do
@request.should_receive(:default_headers).and_return({ '1' => '2' })
headers = @request.make_headers('1' => 3)
headers.should have_key('1')
headers['1'].should == '3'
end
end
describe "header symbols" do