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

Cannot access Guzzle response despite docs saying you can #317

Closed
mbroadhead opened this issue Apr 22, 2022 · 1 comment
Closed

Cannot access Guzzle response despite docs saying you can #317

mbroadhead opened this issue Apr 22, 2022 · 1 comment

Comments

@mbroadhead
Copy link

The docs mention:

Raw response output

By default, this package will return the body of a response as either a deserialized JSON object or a SimpleXMLElement object.

There might be times, when you would rather handle this differently. To do this, simply use any format other than 'json' or 'xml' and the code will return a Guzzle response object.

$response = Forrest::sobjects($resource, ['format'=> 'none']);
$content = (string) $response->getBody(); // Guzzle response

the code will return a Guzzle response object

This is actually not the case. If you pass ['format' => 'none'], the formatter gets set to an instance of BaseFormatter, which returns (string) $response->getBody(). So I don't currently see a way to get the raw Guzzle response.

It would be nice if this actually worked the way the docs describe. I'm trying to download large files from Salesforce and would prefer to get back a guzzle response stream rather than the entire contents of the file as a string in memory.

@villfa
Copy link

villfa commented Sep 20, 2024

This issue has been fixed in v2.19.1 by #349.
You can now retrieve the raw Guzzle response by adding 'format'=> 'raw'.

@omniphx omniphx closed this as completed Sep 21, 2024
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

3 participants