Webiny\Component\Rest\Response\RequestBag::setApi PHP Method

setApi() public method

Set the api configuration name.
public setApi ( string $api )
$api string Api configuration name.
    public function setApi($api)
    {
        $this->api = $api;
        return $this;
    }

Usage Example

Example #1
0
 public function testGetCallbackResultException()
 {
     $methodData = ['method' => 'testCallbackException', 'cache' => ['ttl' => 0], 'header' => ['cache' => ['expires' => 0], 'status' => ['success' => 200, 'error' => 404, 'errorMessage' => '']]];
     $requestBag = new RequestBag();
     $requestBag->setApi('CacheTest')->setClassData(['class' => 'Webiny\\Component\\Rest\\Tests\\Mocks\\MockApiClassCallback', 'version' => '1.0'])->setMethodData($methodData)->setMethodParameters([]);
     $callback = new Callback($requestBag);
     $response = $callback->getCallbackResult()->getOutput();
     $this->assertSame('There has been an error processing the request.', $response['errorReport']['message']);
 }
All Usage Examples Of Webiny\Component\Rest\Response\RequestBag::setApi