fredo 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.6
data/fredo.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fredo}
8
- s.version = "0.1.4"
8
+ s.version = "0.1.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["ilpoldo"]
@@ -41,6 +41,9 @@ module Net #:nodoc: all
41
41
  case request_body
42
42
  when nil then body = StringIO.new
43
43
  when String then body = StringIO.new(body)
44
+ when File then body
45
+ else
46
+ body = StringIO.new(body.to_s)
44
47
  end
45
48
 
46
49
  uri = URI.parse(request.path)
@@ -64,7 +67,6 @@ module Net #:nodoc: all
64
67
  # @socket = Net::HTTP.socket_type.new
65
68
  # Perform the request
66
69
  status, header, body = Fredo.call(rack_env)
67
- # body = body.to_s # should write to rocket or do something fancier?
68
70
 
69
71
  response = Net::HTTPResponse.send(:response_class, "#{status}").new("1.0", "#{status}", body)
70
72
  response.instance_variable_set(:@body, body)
@@ -72,8 +74,8 @@ module Net #:nodoc: all
72
74
  response.instance_variable_set(:@read, true)
73
75
 
74
76
  def response.read_body(*args, &block)
75
- yield @body if block_given?
76
- @body
77
+ yield @body.join("\n") if block_given?
78
+ @body.join("\n")
77
79
  end
78
80
 
79
81
  yield response if block_given?
data/spec/fredo_spec.rb CHANGED
@@ -53,7 +53,7 @@ describe Fredo do
53
53
 
54
54
  url = URI.parse 'http://postyourthoughts.com'
55
55
  http = Net::HTTP.new(url.host)
56
- http.post('/', 'query=foo', 'content-type' => 'text/plain').body.should eql([body])
56
+ http.post('/', 'query=foo', 'content-type' => 'text/plain').body.should eql(body)
57
57
  end
58
58
 
59
59
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 4
9
- version: 0.1.4
8
+ - 6
9
+ version: 0.1.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - ilpoldo