<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -212,6 +212,9 @@ static NSError *ASIUnableToCreateRequestError;
 - (void)appendPostData:(NSData *)data
 {
 	[self setupPostBody];
+	if ([data length] == 0) {
+		return;
+	}
 	if ([self shouldStreamPostDataFromDisk]) {
 		[[self postBodyWriteStream] write:[data bytes] maxLength:[data length]];
 	} else {</diff>
      <filename>Classes/ASIHTTPRequest.m</filename>
    </modified>
    <modified>
      <diff>@@ -17,5 +17,5 @@
 }
 
 - (void)testPostWithFileUpload;
-
+- (void)testEmptyData;
 @end</diff>
      <filename>Classes/Tests/ASIFormDataRequestTests.h</filename>
    </modified>
    <modified>
      <diff>@@ -51,6 +51,21 @@
 	GHAssertTrue(success,@&quot;Failed to upload the correct data (using NSData)&quot;);	
 }
 
+// Test fix for bug where setting an empty string for a form post value would cause the rest of the post body to be ignored (because an NSOutputStream won't like it if you try to write 0 bytes)
+- (void)testEmptyData
+{
+	ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:@&quot;http://allseeing-i.com/ASIHTTPRequest/tests/post-empty&quot;]];
+	[request setPostValue:@&quot;hello&quot; forKey:@&quot;a_non_empty_string&quot;];
+	[request setPostValue:@&quot;&quot; forKey:@&quot;zzz_empty_string&quot;];
+	[request setPostValue:@&quot;there&quot; forKey:@&quot;xxx_non_empty_string&quot;];
+	[request setShouldStreamPostDataFromDisk:YES];
+	[request buildPostBody];
+	[request start];
+	
+	BOOL success = ([[request responseString] isEqualToString:@&quot;a_non_empty_string: hello\r\nzzz_empty_string: \r\nxxx_non_empty_string: there&quot;]);
+	GHAssertTrue(success,@&quot;Failed to send the correct post data&quot;);		
+	
+}
 
 
 @end</diff>
      <filename>Classes/Tests/ASIFormDataRequestTests.m</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>03a71b6a61018521af4eec75e0adb556d80ae74f</id>
    </parent>
  </parents>
  <author>
    <name>Ben Copsey</name>
    <email>ben@allseeing-i.com</email>
  </author>
  <url>http://github.com/pokeb/asi-http-request/commit/194cc4035fc8d6288122a30e5420b20b9d402639</url>
  <id>194cc4035fc8d6288122a30e5420b20b9d402639</id>
  <committed-date>2009-06-16T05:39:17-07:00</committed-date>
  <authored-date>2009-06-16T05:39:17-07:00</authored-date>
  <message>Fixed issue with specifying an empty string for ASIFormDataRequest parameters
Added test for same issue</message>
  <tree>dccda6786c002b9e370c1093995c5d5378c3d9b6</tree>
  <committer>
    <name>Ben Copsey</name>
    <email>ben@allseeing-i.com</email>
  </committer>
</commit>
