<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -230,6 +230,8 @@ static void set_options_from_request(VALUE self, VALUE request) {
 
       state-&gt;upload_file = open_file(filename, &quot;r&quot;);
       curl_easy_setopt(curl, CURLOPT_READDATA, state-&gt;upload_file);
+    } else {
+      rb_raise(rb_eArgError, &quot;Must provide either data or a filename when doing a PUT or POST&quot;);
     }
   } else if (action == rb_intern(&quot;head&quot;)) {
     curl_easy_setopt(curl, CURLOPT_NOBODY, 1);</diff>
      <filename>ext/patron/session_ext.c</filename>
    </modified>
    <modified>
      <diff>@@ -137,12 +137,20 @@ describe Patron::Session do
     body.header['content-length'].should == [data.size.to_s]
   end
 
+  it &quot;should raise when no data is provided to :put&quot; do
+    lambda { @session.put(&quot;/test&quot;, nil) }.should raise_error(ArgumentError)
+  end
+
   it &quot;should upload a file with :put&quot; do
     response = @session.put_file(&quot;/test&quot;, &quot;VERSION.yml&quot;)
     body = YAML::load(response.body)
     body.request_method.should == &quot;PUT&quot;
   end
 
+  it &quot;should raise when no file is provided to :put&quot; do
+    lambda { @session.put_file(&quot;/test&quot;, nil) }.should raise_error(ArgumentError)
+  end
+
   it &quot;should use chunked encoding when uploading a file with :put&quot; do
     response = @session.put_file(&quot;/test&quot;, &quot;VERSION.yml&quot;)
     body = YAML::load(response.body)
@@ -157,12 +165,20 @@ describe Patron::Session do
     body.header['content-length'].should == [data.size.to_s]
   end
 
+  it &quot;should raise when no data is provided to :post&quot; do
+    lambda { @session.post(&quot;/test&quot;, nil) }.should raise_error(ArgumentError)
+  end
+
   it &quot;should upload a file with :post&quot; do
     response = @session.post_file(&quot;/test&quot;, &quot;VERSION.yml&quot;)
     body = YAML::load(response.body)
     body.request_method.should == &quot;POST&quot;
   end
 
+  it &quot;should raise when no file is provided to :post&quot; do
+    lambda { @session.post_file(&quot;/test&quot;, nil) }.should raise_error(ArgumentError)
+  end
+
   it &quot;should use chunked encoding when uploading a file with :post&quot; do
     response = @session.post_file(&quot;/test&quot;, &quot;VERSION.yml&quot;)
     body = YAML::load(response.body)</diff>
      <filename>spec/session_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>946019ac7b93be829a025c35865a7f757d6cd168</id>
    </parent>
  </parents>
  <author>
    <name>Phillip Toland</name>
    <email>phil.toland@gmail.com</email>
  </author>
  <url>http://github.com/toland/patron/commit/22f387bede76c8c39bff6598abf75599fb4f78dd</url>
  <id>22f387bede76c8c39bff6598abf75599fb4f78dd</id>
  <committed-date>2009-10-04T17:25:11-07:00</committed-date>
  <authored-date>2009-10-04T17:25:11-07:00</authored-date>
  <message>Raise an ArgumentError if no data or filename is provided to PUT or
POST.</message>
  <tree>620b51caedd27f9a2b9b1469ac09c7d533fc6d3d</tree>
  <committer>
    <name>Phillip Toland</name>
    <email>phil.toland@gmail.com</email>
  </committer>
</commit>
