Task #44712
Decouple Argument-Building in the HTTP-Request-Constructor
Status: | Accepted | Start date: | 2013-01-22 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | - | % Done: | 0% |
|
Category: | Http | |||
Target version: | - | |||
Sprint: | Has patch: | No | ||
PHP Version: | Complexity: |
Description
It should be possible to create a HTTP-Request-Object without reading all arguments in the Constructor, especially the body-arguments in a PUT/POST-Request from the input stream "php://input".
If I need a HTTP-Request-Object in my RequestHandler for decide if i can handle this Request, the Creation of the HTTP-Request-Object empties the input stream and every later created HTTP-Request-Object gets no body-arguments.
Perhaps the input stream can be read first, when accessing the Request-Arguments
Related issues
History
#1 Updated by Robert Lemke over 2 years ago
- Status changed from New to Accepted
Yes, I agree – the arguments could be initialized more lazy
#2 Updated by Bastian Waidelich over 2 years ago
There's a related issue that is kind of a blocker for REST services currently:
Imagine a put request to http://localhost/products/<uuid> with a request body of
1<product> 2 <title>modified title</title> 3</product>
This results in the GET arguments array('product' => '<uuid>')
and decoded body arguments array('product' => array('title' => 'modified title'))
While merging the arguments in Http\Request::buildUnifiedArguments()
the UUID is overridden.
BTW: This works when using object routing
because then the product title is transformed into array('__identity' => '<uuid>')
which can be merged with the content arguments