Task #44712
Decouple Argument-Building in the HTTP-Request-Constructor
0%
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
Updated by Robert Lemke almost 8 years ago
- Status changed from New to Accepted
Yes, I agree – the arguments could be initialized more lazy
Updated by Bastian Waidelich almost 8 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
<product> <title>modified title</title> </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