Skip to content

[HTTPFoundation] PUT Request Data #793

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

Chekote
Copy link

@Chekote Chekote commented May 5, 2011

Modified Request to handle data submitted via PUT.

I wanted to update the tests for this, but I don't know if it's possible, given that you cant modify the value of the php://input stream.

@igorw
Copy link
Contributor

igorw commented May 5, 2011

This is already supported. Look at Request::getContent().

@Chekote
Copy link
Author

Chekote commented May 5, 2011

That's not the same thing. You can't bind a form to a request submitted via PUT unless the PUT request values are actually part of the Request::request ParameterBag.

@schmittjoh
Copy link
Contributor

This cannot be applied since php://input can only be read once. People would have no way to access the PUT data anymore. Besides the put data might not be a url-encoded list of key/value pairs.

If you need this then it's better if you do that in a Request listener.

@Chekote
Copy link
Author

Chekote commented May 5, 2011

OK, the read-once thing is certainly a deal breaker. But there must be a way to implement this in the Request class as standard. Symfony 1 supported PUT requests without a problem.

@Chekote
Copy link
Author

Chekote commented May 6, 2011

I flattened the two commits. The pull no longer causes the Request have no value for getContent().

@igorw
Copy link
Contributor

igorw commented May 6, 2011

You probably also want to check if the content type is 'application/x-www-form-urlencoded' (or null?). As Johannes suggested, this should probably go in a RequestListener.

Kind of like is done in the RestBundle: https://github.com/FriendsOfSymfony/RestBundle/blob/master/Request/RequestListener.php except it will be in the FrameworkBundle.

@Chekote
Copy link
Author

Chekote commented May 6, 2011

I wasn't aware of the existence of RestBundle. I'm going to investigate that before pursuing this further.

Thanks for the pointer.

@lsmith77
Copy link
Contributor

lsmith77 commented May 9, 2011

@Chekote: is there anything missing in RestBundle for your use case?

@Chekote
Copy link
Author

Chekote commented May 9, 2011

Not sure yet. I'm going to be trying it out today (or Tomorrow, Monday's are
hectic).

On Mon, May 9, 2011 at 7:38 AM, lsmith77 <
reply@reply.github.com>wrote:

@Chekote: is there anything missing in RestBundle for your use case?

Reply to this email directly or view it on GitHub:
#793 (comment)

@fabpot
Copy link
Member

fabpot commented May 9, 2011

I've just create a patch in the Form component here #849

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants