Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erro de download #38

Open
xoinas opened this issue Oct 23, 2024 · 0 comments
Open

Erro de download #38

xoinas opened this issue Oct 23, 2024 · 0 comments

Comments

@xoinas
Copy link

xoinas commented Oct 23, 2024

Tem um erro na função de download em CallApi.php: a reposta em caso de sucesso é um guzzle stream, mas como é feita uma conversão para json, sempre retorna null.

Para fixar, atualizei a TecnoSpeed\Plugnotas\Communication\Response dessa forma:

public static function parse($response, $isFile = false)
    {
        $responseObject = new Response;
        $responseObject->statusCode = $response->getStatusCode();
        if ($isFile && $responseObject->statusCode == 200) {
            $responseObject->body = $response->getBody();
        } else {
            $responseObject->body = \json_decode($response->getBody()->getContents());
        }

        return $responseObject;
    }

Assim, em caso de statusCode = 200, è possivel recuperar dentro do body o stream original guzzle e extrair o arquivo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant