Ejemplo n.º 1
0
 /**
  * @param HttpParameterBag $parameterBag
  * @param OutputHandlerInterface $outputHandler
  * @return HttpResponse
  */
 public function execute(HttpParameterBag $parameterBag, OutputHandlerInterface $outputHandler = null)
 {
     $content = '';
     if ($parameterBag->getParameterPostFormat() == 'application/json') {
         $content = json_encode($parameterBag->getParameterPost());
     }
     $request = new HttpRequest($parameterBag->getMethod(), $this->getUrl($parameterBag), $parameterBag->getHeaders(), $content);
     $response = $this->getHttpAdapter()->handleRequest($request);
     $this->checkResponse($response);
     return $this->handleResponse($response, $outputHandler);
 }
Ejemplo n.º 2
0
 /**
  * @param HttpParameterBag $parameterBag
  * @return array
  */
 public function getDefaultHeaders(HttpParameterBag $parameterBag)
 {
     $parametersPost = $parameterBag->getParameterPost();
     if (!empty($parametersPost)) {
         $parametersPost = json_encode($parameterBag->getParameterPost());
     } else {
         $parametersPost = '';
     }
     $signatureKey = strtolower($parameterBag->getMethod()) . $this->getRequestUrl($parameterBag) . $parametersPost . $this->getSignatureKey();
     $httpheaders = array('Accept' => $parameterBag->getAccept(), 'Signature' => md5($signatureKey));
     return $httpheaders;
 }