Пример #1
0
 private function addMd5(CommandInterface $command)
 {
     $request = $command->getRequest();
     $body = $request->getBody();
     if ($body && $body->getSize() > 0) {
         if (false !== ($md5 = $body->getContentMd5(true, true))) {
             $request->setHeader('Content-MD5', $md5);
         }
     }
 }
Пример #2
0
 public function parse(CommandInterface $command)
 {
     $response = $command->getRequest()->getResponse();
     // Account for hard coded content-type values specified in service descriptions
     if ($contentType = $command['command.expects']) {
         $response->setHeader('Content-Type', $contentType);
     } else {
         $contentType = (string) $response->getHeader('Content-Type');
     }
     return $this->handleParsing($command, $response, $contentType);
 }
Пример #3
0
 /**
  * Get the Exception that caused the given $command to fail
  *
  * @param CommandInterface $command Failed command
  *
  * @return \Exception|null
  */
 public function getExceptionForFailedCommand(CommandInterface $command)
 {
     return $this->getExceptionForFailedRequest($command->getRequest());
 }