send() public method

Deliver the request.
public send ( Psr\Http\Message\RequestInterface $request, array $options = [] ) : Psr\Http\Message\ResponseInterface
$request Psr\Http\Message\RequestInterface Psr7 request.
$options array [optional] { Request options. @type int $retries Number of retries for a failed request. **Defaults to** `3`. @type array $httpOptions HTTP client specific configuration options. }
return Psr\Http\Message\ResponseInterface
 public function testThrowsExceptionWithNonRetryableError()
 {
     $nonRetryableErrorMessage = '{"error": {"errors": [{"reason": "notAGoodEnoughReason"}]}}';
     $actualAttempts = 0;
     $hasTriggeredException = false;
     $requestWrapper = new RequestWrapper(['httpHandler' => function () use(&$actualAttempts, $nonRetryableErrorMessage) {
         $actualAttempts++;
         throw new \Exception($nonRetryableErrorMessage, 429);
     }]);
     try {
         $requestWrapper->send(new Request('GET', 'http://www.example.com'));
     } catch (\Exception $ex) {
         $hasTriggeredException = true;
     }
     $this->assertTrue($hasTriggeredException);
     $this->assertEquals(1, $actualAttempts);
 }