/**
  * {@inheritdoc}
  */
 protected function build()
 {
     parent::build();
     // json responses have the "text/javascript; charset=UTF-8" content type ...
     if ('json' === $this->get('format')) {
         $this->set('command.expects', 'application/json');
     }
 }
 public function build()
 {
     parent::build();
     $client = $this->getClient();
     $username = $client->getUsername();
     $password = $client->getPassword();
     $this->request = $this->getRequestSerializer()->prepare($this);
     $this->request->addPostFields(array('user' => $username, 'pass' => $password));
 }
Exemple #3
0
 /**
  * Create the request object that will carry out the command
  */
 protected function build()
 {
     parent::build();
     // This request needs the master secret
     $user = $this->getClient()->getConfig()->get('appKey');
     $pass = $this->getClient()->getConfig()->get('appMasterSecret');
     $this->request->setAuth($user, $pass);
     if (!$this->request->hasHeader('Content-Type')) {
         $this->request->setHeader('Content-Type', $this->jsonContentType);
     }
     $payload = $this->assemblePayload();
     $this->request->setBody(json_encode($payload));
 }
 /**
  * {@inheritdoc}
  */
 protected function build()
 {
     parent::build();
     // Ensure that the body of the request ALWAYS includes some JSON. By default, this is an empty object.
     if (!$this->request->getBody()) {
         $this->request->setBody('{}');
     }
     // Never send the Expect header when interacting with a JSON query service
     $this->request->removeHeader('Expect');
     // Always send JSON requests as a raw string rather than using streams to avoid issues with
     // cURL error code 65: "necessary data rewind wasn't possible".
     // This could be removed after PHP addresses https://bugs.php.net/bug.php?id=47204
     $this->request->getCurlOptions()->set(CurlHandle::BODY_AS_STRING, true);
 }
 /**
  * {@inheritdoc}
  */
 protected function build()
 {
     // By default, JSON commands with AWS require no response model processing
     if ($this->operation->getResponseType() == OperationInterface::TYPE_MODEL && $this->get(self::RESPONSE_PROCESSING) == self::TYPE_MODEL) {
         $this->responseParser = $this->get('command.model_processing') ? OperationResponseParser::getInstance() : NoTranslationOperationResponseParser::getInstance();
     } else {
         $this->responseParser = DefaultResponseParser::getInstance();
     }
     parent::build();
     // Ensure that the body of the request ALWAYS includes some JSON. By default, this is an empty object.
     if (!$this->request->getBody()) {
         $this->request->setBody('{}');
     }
     // Never send the Expect header when interacting with a JSON query service
     $this->request->removeHeader('Expect');
 }
Exemple #6
0
 /**
  * {@inheritdoc}
  */
 protected function build()
 {
     parent::build();
     $this->request->getQuery()->set('token', $this->getClient()->getConfig('token'));
 }