/**
  * @param string $method
  * @param string $path
  * @param array $headers
  * @param string|null $body
  * @return RequestProcessor
  */
 public function request($method, $path, array $headers = [], $body = NULL)
 {
     $processor = new RequestProcessor($this->sl, $this->logger, $this->basePath);
     try {
         $processor->request($method, $path, $headers + $this->defaultHeaders, $body);
     } finally {
         $this->logger->output();
     }
     return $processor;
 }
Пример #2
0
 /**
  * @param string $method
  * @param string $path
  * @param array $headers
  * @param string|null $body
  * @return Http\Response
  */
 protected function getHttpResponse($method, $path, array $headers = [], $body = NULL)
 {
     $sl = $this->getContainer();
     $processor = new Api\RequestProcessor($sl, $logger = new Api\HttpLogger(), $this->baseUrl);
     $processor->setRouter($this->router);
     try {
         $processor->request($method, $path, $headers, $body);
     } finally {
         $this->appResponse = $processor->getAppResponse();
         $classRefl = new \ReflectionClass($this);
         $logger->write(dirname($classRefl->getFileName()) . '/requests.log');
     }
     return $processor->getHttpResponse();
 }