jnunemaker-httparty 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/History CHANGED
@@ -1,3 +1,6 @@
1
+ == 0.2.4 2008-12-23
2
+ * 1 bug fix
3
+ * Fixed that mimetype detection was failing if no mimetype was returned from service (skippy)
1
4
  == 0.2.3 2008-12-23
2
5
  * 1 bug fix
3
6
  * Fixed typecasting class variable naming issue
data/httparty.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{httparty}
5
- s.version = "0.2.3"
5
+ s.version = "0.2.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["John Nunemaker"]
@@ -106,6 +106,7 @@ module HTTParty
106
106
  # Uses the HTTP Content-Type header to determine the format of the response
107
107
  # It compares the MIME type returned to the types stored in the AllowedFormats hash
108
108
  def format_from_mimetype(mimetype) #:nodoc:
109
+ return nil if mimetype.nil?
109
110
  AllowedFormats.each { |k, v| return k if mimetype.include?(v) }
110
111
  end
111
112
 
@@ -1,3 +1,3 @@
1
1
  module HTTParty
2
- Version = '0.2.3'
2
+ Version = '0.2.4'
3
3
  end
@@ -48,6 +48,20 @@ describe HTTParty::Request do
48
48
  response.stub!(:body).and_return("")
49
49
  @request.perform.should be_nil
50
50
  end
51
+
52
+ it "should not fail for missing mime type" do
53
+ http = Net::HTTP.new('localhost', 80)
54
+ @request.stub!(:http).and_return(http)
55
+
56
+ response = Net::HTTPOK.new("1.1", 200, "Content for you")
57
+ response.stub!(:[]).with('content-type').and_return(nil)
58
+ response.stub!(:body).and_return('Content for you')
59
+
60
+ http.stub!(:request).and_return(response)
61
+
62
+ @request.options[:format] = :html
63
+ @request.perform.should == 'Content for you'
64
+ end
51
65
 
52
66
  describe "that respond with redirects" do
53
67
  def setup_redirect
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jnunemaker-httparty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Nunemaker