Hi,

I am writing a test for a REST controller which uses the PUT http method.
Here is an excerpt of code showing how Symfony 2's test client handles
request parameters:

if (in_array(strtolower($method), array('post', 'put', 'delete'))) {
            $request = $parameters;
            $query = array();
            $defaults['CONTENT_TYPE'] = 'application/x-www-form-urlencoded';
}

Unfortunately, that is not PHP's default behavior for PUT. This works as
expected for POST but not for PUT, as the request has to be explicitly read
from php://input, as explained on
http://php.net/manual/en/features.file-upload.put-method.php. According to
my tests, the content body of the request is not parsed into $_POST when the
method is PUT. The test client's behavior is different from PHP's behavior.
Hence, I have two questions:

1) What would be the best way to support this in the test client ? I doubt
it is possible for the test client to write on php://input so I fail to see
what options we have there.
2) What would be the best way to support this  seamlessly with the Request
object, considering that PUT can be used to send something else than files,
especially in a REST context ?

Thank you for your comments,
-- 
Nicolas A. Bérard-Nault ([email protected])

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to