-
Notifications
You must be signed in to change notification settings - Fork 11k
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
[5.5] Add ->post() method to Request #20238
Conversation
When would you actually use this? |
Given you're on <form action="" method="POST">
<input name="page" type="text">
<input type="submit" value="Submit">
</form> In this case, With this PR merged, you can safely assume all the data you retrieved with |
I like this, i already had to workaround with something like this before. |
@svenluijten Why this so important for you to get exactly |
I needed this because I wanted to log certain properties of the request, like any query strings that were passed, any POSTed data, the URL etc. But the query strings and POST data needed to be logged separately. If I used I think there's a use-case for this, just as there's a use case for the |
@cwhite92 that make sense |
$request->request returns $_POST parameters only |
Yeah, that's what this PR implements.
…On Mon, 24 Jul 2017 at 11:09 pm, Clayton Stone ***@***.***> wrote:
$request->request return $_POST parameters only
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#20238 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACYcWrSaAKnBnYD7i98YRmaOHBYAJbcKks5sRRYOgaJpZM4OhoOv>
.
|
So and |
@devcircus No,
|
Yeah just seems like the functionality is already there. Lots of PRs lately that simply save a few keystrokes. Then again, I've never had the same parameters in POST and GET at the same time, so never had the need for separating it like this, maybe it'll come in handy. |
I think this makes a lot of sense. I mean we already have |
+1 for this. I don't like that we can't take input only from POST. |
What would ->post() return for GET requests? Isn't Request.php#L353 replacing the container you presume to contain post-data with the query string, or perhaps even parsed json data? |
The
->post()
method will get all data from the request body (POST body), or when given a$key
, it'll get that specific value. Using Symfony's public$request
property on theRequest
object: https://github.com/symfony/http-foundation/blob/master/Request.php#L76-L81