コード例 #1
0
ファイル: RequestHandler.php プロジェクト: gsdevme/jumpcloud
 /**
  * @param GuzzleClient $client
  * @param RequestInterface $request
  * @return ResponseInterface
  */
 public function handle(GuzzleClient $client, RequestInterface $request)
 {
     try {
         $response = $client->send(new HttpRequest($request->getMethod(), $request->getUri(), $request->getHeaders(), $this->jsonEncoder->encode($request->getBody())));
     } catch (\Exception $e) {
         $this->logger->debug(sprintf('Exception thrown during Guzzle request'), ['message' => $e->getMessage(), 'line' => $e->getLine(), 'file' => $e->getFile(), 'trace' => $e->getTraceAsString()]);
         $response = new Response(500);
         if ($e instanceof ClientException) {
             $response = new Response(401);
         }
     }
     return $request->getResponseFactory()->create($response);
 }
コード例 #2
0
 /**
  * @inheritDoc
  */
 public function getHeaders()
 {
     return $this->request->getHeaders();
 }