<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -139,6 +139,7 @@ module HTTParty
       end
       
       def parse_response(body) #:nodoc:
+        return nil if body.nil? or body.empty?
         case @format
         when :xml
           Hash.from_xml(body)</diff>
      <filename>lib/httparty.rb</filename>
    </modified>
    <modified>
      <diff>@@ -141,5 +141,20 @@ describe HTTParty do
         Foo.send(:send_request, 'get', '/foo', :basic_auth =&gt; 'string')
       end.should raise_error(ArgumentError)
     end
+
+    it &quot;should not attempt to parse empty responses&quot; do
+      http = Net::HTTP.new('localhost', 80)
+      Foo.stub!(:http).and_return(http)
+      response = Net::HTTPNoContent.new(&quot;1.1&quot;, 204, &quot;No content for you&quot;)
+      response.stub!(:body).and_return(nil)
+      http.stub!(:request).and_return(response)
+
+      Foo.headers.clear # clear out bogus settings from other specs
+      Foo.format :xml
+      Foo.send(:send_request, 'get', '/bar').should be_nil
+
+      response.stub!(:body).and_return(&quot;&quot;)
+      Foo.send(:send_request, 'get', 'bar').should be_nil
+    end
   end
 end
\ No newline at end of file</diff>
      <filename>spec/httparty_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>df9957cfa569c4a15230f5b2cda0a5d8f1b3e727</id>
    </parent>
  </parents>
  <author>
    <name>Alex Vollmer</name>
    <email>alex@evri.com</email>
  </author>
  <url>http://github.com/jnunemaker/httparty/commit/31ad4f91c8c234b15b0d415eb2c088f6838846dc</url>
  <id>31ad4f91c8c234b15b0d415eb2c088f6838846dc</id>
  <committed-date>2008-10-24T21:32:31-07:00</committed-date>
  <authored-date>2008-08-27T13:38:19-07:00</authored-date>
  <message>Treat nil or empty bodies specially to avoid blowing up during response parsing.</message>
  <tree>7c214ed9d7df3205196c01124dcb61d6f99f48a3</tree>
  <committer>
    <name>John Nunemaker</name>
    <email>nunemaker@gmail.com</email>
  </committer>
</commit>
