Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-19116

Using parameters are not supported when defining custom HTTP methods

    Details

      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

        Activity

        Show
        Damien Pobel (eZ) added a comment - Fixed in ezpublish master https://github.com/ezsystems/ezpublish/commit/57dfb25625122eb8b9d9b0e3526930ee525096c4

          People

          • Assignee:
            Damien Pobel (eZ)
            Reporter:
            Damien Pobel (eZ)
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: