righttp 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
data/lib/rig/http.rb CHANGED
@@ -28,7 +28,7 @@ module Rig
28
28
  def send
29
29
  begin
30
30
  tcp_socket = TCPSocket.new( @options[:host], @options[:port] )
31
- tcp_socket.write( @header.to_s)# + @body.to_s )
31
+ tcp_socket.write( @header.to_s + @body.to_s )
32
32
  response = tcp_socket.read
33
33
  rescue => exception
34
34
  puts exception.message
@@ -69,13 +69,12 @@ module Rig
69
69
  }
70
70
  uri_options.merge( options.last )
71
71
  when :advanced
72
- {
73
- :http_method => options.first[:http_method] || "GET",
74
- :host => options.first[:host],
75
- :port => options.first[:port] || 80,
76
- :path => options.first[:path] || "/",
77
- :query => options.first[:query]
78
- }
72
+ options.first[:http_method] ||= "GET"
73
+ options.first[:host]
74
+ options.first[:port] ||= 80
75
+ options.first[:path] ||= "/"
76
+ options.first[:query]
77
+ options.first
79
78
  else
80
79
  raise ArgumentError
81
80
  end
data/righttp.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{righttp}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["hukl"]
data/test/test_http.rb CHANGED
@@ -77,7 +77,6 @@ class TestHttp < Test::Unit::TestCase
77
77
  :port=>80,
78
78
  :path=>"/",
79
79
  :http_method=>"GET",
80
- :query => nil,
81
80
  :content_type=>"text/plain",
82
81
  :content_length=>0
83
82
  }
@@ -208,6 +207,22 @@ class TestHttp < Test::Unit::TestCase
208
207
  assert_equal 200, response.status
209
208
  end
210
209
 
210
+ test "more advanced post request" do
211
+ request = Rig::HTTP.new(
212
+ :host => "beta.hoccer.com",
213
+ :path => "/events",
214
+ :http_method => "POST",
215
+ :body => {
216
+ "event[type]" => "Drop",
217
+ "event[latitude]" => "latitude",
218
+ "event[longitude]" => "longitude",
219
+ "event[location_accuracy]" => 100,
220
+ "event[lifetime]" => 600
221
+ }
222
+ )
223
+ assert_equal false, request.body.multipart?
224
+ end
225
+
211
226
  #test "multipart body gets properly created" do
212
227
  # post = HTTP.new(
213
228
  # :host => "localhost",
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 2
9
- version: 0.1.2
8
+ - 3
9
+ version: 0.1.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - hukl