Details
-
Bug
-
Resolution: Fixed
-
Medium
-
2012.1
-
None
Description
It doesn't work to send parameters in custom methods ( for instance defining 'http-pubish')
Let's say you send parameters like this:
$additionalOptions = array ( 'content' => http_build_query( array( 'publishparam1' => 'this is value of publishparam1', 'publishparam2' => 'this is value of publishparam2', ), '', '&' ) ); $result = @file_get_contents( $restUrl, false, $this->getStreamContext( 'PUBLISH', $additionalOptions ) );
In the controller, the call to getParsedBody() will always return null:
public function doPublishContent() { $res = new ezcMvcResult(); // Fixme : getParsedBody() seems to return NULL even though variables are sent in the request $inputVariables = $this->request->getParsedBody(); if( is_array( $inputVariables ) and array_key_exists( 'deleteparam1', $inputVariables ) and array_key_exists( 'deleteparam2', $inputVariables ) and ( $inputVariables['deleteparam1'] === 'this is value of publishparam1' ) and ( $inputVariables['deleteparam2'] === 'this is value of publishparam2' ) ) { $res->variables['message'] = "Received a PUBLISH request, input variables OK"; } else { $res->variables['message'] = "Received a PUBLISH request, required input variables not received"; } return $res; }
ref the testeZRestHTTPMethodTests::testHTTPPublishWithParameters.
In the controller ( eZRestHTTPMethodControllerTest::doPublishContent(), the function getParsedBody() always returns NULL