Drahak\Restful\Application\UI\ResourcePresenter::sendResource PHP Method

sendResource() public method

Get REST API response
public sendResource ( string $contentType = NULL ) : Nette\Application\IResponse
$contentType string
return Nette\Application\IResponse
    public function sendResource($contentType = NULL)
    {
        if (!$this->resource instanceof IResource) {
            $this->resource = $this->resourceFactory->create($this->resource);
        }
        try {
            $response = $this->responseFactory->create($this->resource, $contentType);
            $this->sendResponse($response);
        } catch (InvalidStateException $e) {
            $this->sendErrorResource(BadRequestException::unsupportedMediaType($e->getMessage(), $e), $contentType);
        }
    }