pauldix-typhoeus 0.0.18 → 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
data/lib/typhoeus/easy.rb CHANGED
@@ -103,6 +103,9 @@ module Typhoeus
103
103
  value = params[k]
104
104
  if value.is_a? Hash
105
105
  value.keys.collect {|sk| CGI.escape("#{k}[#{sk}]") + "=" + CGI.escape(value[sk].to_s)}
106
+ elsif value.is_a? Array
107
+ key = CGI.escape(k.to_s)
108
+ value.collect { |v| "#{key}=#{CGI.escape(v.to_s)}" }.join('&')
106
109
  else
107
110
  "#{CGI.escape(k.to_s)}=#{CGI.escape(params[k].to_s)}"
108
111
  end
@@ -202,4 +205,4 @@ module Typhoeus
202
205
  version
203
206
  end
204
207
  end
205
- end
208
+ end
data/lib/typhoeus.rb CHANGED
@@ -12,7 +12,7 @@ require 'typhoeus/remote_proxy_object'
12
12
  require 'typhoeus/response'
13
13
 
14
14
  module Typhoeus
15
- VERSION = "0.0.18"
15
+ VERSION = "0.0.19"
16
16
 
17
17
  def self.easy_object_pool
18
18
  @easy_objects ||= []
@@ -47,6 +47,22 @@ describe Typhoeus::Easy do
47
47
  end
48
48
  end
49
49
 
50
+ describe "params=" do
51
+ it "should handle arrays of params" do
52
+ easy = Typhoeus::Easy.new
53
+ easy.url = "http://localhost:3002/index.html"
54
+ easy.method = :get
55
+ easy.request_body = "this is a body!"
56
+ easy.params = {
57
+ :foo => 'bar',
58
+ :username => ['dbalatero', 'dbalatero2']
59
+ }
60
+
61
+ easy.url.should =~ /\?.*username=dbalatero&username=dbalatero2/
62
+ end
63
+ end
64
+
65
+
50
66
  describe "put" do
51
67
  it "should perform a put" do
52
68
  easy = Typhoeus::Easy.new
@@ -119,4 +135,4 @@ describe Typhoeus::Easy do
119
135
  easy.response_body.should include("this is a body!")
120
136
  end
121
137
  end
122
- end
138
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pauldix-typhoeus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.18
4
+ version: 0.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Dix