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

Response format defaults to json, doc update for overriding? #383

Closed
ChrisHardie opened this issue Feb 9, 2022 · 1 comment
Closed

Response format defaults to json, doc update for overriding? #383

ChrisHardie opened this issue Feb 9, 2022 · 1 comment
Assignees

Comments

@ChrisHardie
Copy link

I noticed today that this call:

Twitter::forApiV2()->getUserByUsername($username);

was returning a JSON string. Reading the docs, I see:

By default responses will be returned as objects. To change this, use the format option in the parameters you pass to any method.

I tried passing 'format' => 'object' but that didn't work. Then I tried 'response_format' => 'object' and that worked.

Could you clarify what the expected default return format is? Should I submit a PR to clarify the param key name in the docs? Thanks!

@reliq reliq self-assigned this Apr 5, 2022
@reliq
Copy link
Collaborator

reliq commented Apr 5, 2022

Hi @ChrisHardie, thank you for reporting this. For API v2 the response format defaults to JSOn, see https://github.com/atymic/twitter/blob/main/src/Concern/ApiV2Behavior.php#L24

I will make an adjustment in the readme to reflect this.

reliq added a commit that referenced this issue Apr 5, 2022
@reliq reliq closed this as completed in b1804ce Apr 5, 2022
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

2 participants