Req #17460 [Fbk]: Allow set custom content-type header for POST requests

From: Date: Thu, 03 Jun 2010 01:30:49 +0000
Subject: Req #17460 [Fbk]: Allow set custom content-type header for POST requests
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to pear-bugs+get-3866@lists.php.net to get a copy of this message
Edit report at http://pear.php.net/bugs/bug.php?id=17460&edit=1 ID: 17460 Updated by: dimzav@gmail.com Reported By: dimzav at gmail dot com Summary: Allow set custom content-type header for POST requests Status: Feedback Type: Feature/Change Request Package: HTTP_Request2 Operating System: Windows, Linux Package Version: 0.5.2 PHP Version: 5.2.12 Roadmap Versions: New Comment: $request = new HTTP_Request2 ( $url, HTTP_Request2::METHOD_POST, array ( 'adapter' => new HTTP_Request2_Adapter_Curl(), 'ssl_verify_peer' => false, 'connect_timeout' => Config::CONNECTION_TIMEOUT ) ); ... $request->setHeader('Content-Type', ' application/x-www-form-urlencoded; charset=UTF-8'); ... $request->addPostParameter('token', $token); ... $result = $request->send(); Expected: POST body isn't empty. Actual result: POST body is and content length = 0. Previous Comments: ------------------------------------------------------------------------ [2010-06-03 01:06:44] doconnor -Status: Open +Status: Feedback If you could whip up a bit of code showing what you want to do; the expected vs actual results... ie.. $request = new HTTP_Request2(); $request->setFoo(); $result = $request->send(); assert($result->didSomething()); ... then you'll probably find someone happy to implement this for you :) ------------------------------------------------------------------------ [2010-06-02 20:10:49] zyava Description: ------------ Look on next line in the HTTP_Request2->getBody method: if ('application/x-www-form-urlencoded' == $this->headers['content-type']) { If I wish to set manual content-type header, for example: Content-Type: application/x-www-form-urlencoded; charset=utf-8 because of this line post body will not be generated and sent. I propose change this line to: if (strpos($this->headers['content-type'], 'application/x-www-form-urlencoded') !== false) { ------------------------------------------------------------------------ -- Edit this bug report at http://pear.php.net/bugs/bug.php?id=17460&edit=1

« previous php.pear.bugs (#3866) next »