src/Scalify/PuppetMaster/Client/Client.php
protected function send(RequestInterface $request): ResponseInterface
    {
        $request = $request->withHeader("Authorization", sprintf("Bearer %s", $this->apiToken));
        $request = $request->withHeader("Content-Type", "application/json");
        $request = $request->withHeader("Accept", "application/json");

        try {
            $response = $this->client->send($request);
        } catch (GuzzleException $e) {
            if ($e->getCode() === 401) {
                throw new ClientException("Authorization failed. Did you specify the right api token?", $request, null, $e);
            }

            throw new ClientException(sprintf("Failed to execute request (code %d): %s", $e->getCode(), $e->getMessage()), $request, null, $e);
        }

        return $response;
    }
protected function send(RequestInterface $request): ResponseInterface
    {
        $request = $request->withHeader("Authorization", sprintf("Bearer %s", $this->apiToken));
        $request = $request->withHeader("Content-Type", "application/json");
        $request = $request->withHeader("Accept", "application/json");

        try {
            $response = $this->client->send($request);
        } catch (GuzzleException $e) {
            if ($e->getCode() === 401) {
                throw new ClientException("Authorization failed. Did you specify the right api token?", $request, null, $e);
            }

            throw new ClientException(sprintf("Failed to execute request (code %d): %s", $e->getCode(), $e->getMessage()), $request, null, $e);
        }

        return $response;
    }
Execute a request, adding required JSON headers and authorization.

@param RequestInterface $request

@return ResponseInterface