for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of coisa/http.
*
* (c) Felipe Sayão Lobato Abreu <[email protected]>
* This source file is subject to the license that is bundled
* with this source code in the file LICENSE.
*/
declare(strict_types=1);
namespace CoiSA\Http\Handler;
use Psr\Http\Client\ClientInterface;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
* Class PsrHttpClientHandler
* @package CoiSA\Http\Handler
final class PsrHttpClientHandler implements ClientInterface, RequestHandlerInterface
{
* @var ClientInterface
private $client;
* PsrHttpClientHandler constructor.
* @param ClientInterface $client
public function __construct(ClientInterface $client)
$this->client = $client;
}
* @param RequestInterface $request
* @throws \Psr\Http\Client\ClientExceptionInterface
* @return ResponseInterface
public function sendRequest(RequestInterface $request): ResponseInterface
return $this->client->sendRequest($request);
* @param ServerRequestInterface $request
public function handle(ServerRequestInterface $request): ResponseInterface
return $this->sendRequest($request);