Ver código fonte

ZF-11418: set the enctype to null in resetParameters()

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@24080 44c647ce-9c0f-0410-b52a-842ac1e357ba
ezimuel 14 anos atrás
pai
commit
88d6020f0d

+ 2 - 1
library/Zend/Http/Client.php

@@ -782,7 +782,8 @@ class Zend_Http_Client
         $this->paramsPost    = array();
         $this->files         = array();
         $this->raw_post_data = null;
-
+        $this->enctype       = null;
+        
         if($clearAll) {
             $this->headers = array();
             $this->last_request = null;

+ 21 - 0
tests/Zend/Http/Client/CommonHttpTests.php

@@ -996,6 +996,27 @@ abstract class Zend_Http_Client_CommonHttpTests extends PHPUnit_Framework_TestCa
         $this->assertContains('REQUEST_METHOD: PUT', $response->getBody(), $response->getBody());
     }
 
+
+    /**
+     * @group ZF-11418
+     */
+    public function testMultiplePuts()
+    {
+        $this->client->setUri($this->baseuri . 'ZF10645-PutContentType.php');
+        $data= 'test';
+        $this->client->setRawData($data, 'text/plain');
+        $this->client->setMethod(Zend_Http_Client::PUT);
+        $response = $this->client->request();
+        $this->assertContains('REQUEST_METHOD: PUT', $response->getBody(), $response->getBody());
+
+        $this->client->resetParameters(true);
+        $this->client->setUri($this->baseuri . 'ZF10645-PutContentType.php');
+        $this->client->setMethod(Zend_Http_Client::PUT);
+        $response = $this->client->request();
+        $request= $this->client->getLastRequest();
+        $this->assertNotContains('Content-Type: text/plain', $request);
+
+    }
     /**
      * Internal helpder function to get the contents of test files
      *