Issues

ZF-10645: Zend_Http_Client Content-Type Header for PUT Requests

Description

Currently, trying to add content-type header for PUT requests is impossible as the conditional block starting at line: 1107 checks only for method of POST.

Since it is totally reasonable for a PUT request to also carry the Content-Type header I propose changing that line to include the PUT method as well.

SO change: // Set the Content-Type header if ($this->method == self::POST && (! isset($this->headers[strtolower(self::CONTENT_TYPE)]) && isset($this->enctype))) {

        $headers[] = self::CONTENT_TYPE . ': ' . $this->enctype;
    }

To: // Set the Content-Type header if (($this->method == self::POST || $this->method == self::PUT) && (! isset($this->headers[strtolower(self::CONTENT_TYPE)]) && isset($this->enctype))) {

        $headers[] = self::CONTENT_TYPE . ': ' . $this->enctype;
    }

Thanks,

Steve

Comments

Fixed in 1.11 release branch and trunk.