Conversation
spidgorny
commented
Apr 15, 2021
- Sometimes Twitter API return "Rate Limit Exceeded" as text. JSON parsing fails in this case. Fixed by detecting content-type header and returning either {data: } or {text: string} in get() method
- When using pagination, it's important to fetch the "meta" data with pagination token. Changed so it returns both like this: {data, meta, headers}
…rsing fails in this case. Fixed by detecting content-type header and returning either {data: <json>} or {text: string} in get() method
- When using pagination, it's important to fetch the "meta" data with pagination token. Changed so it returns both like this: {data, meta, headers}
Owner
|
This change makes sense to me, however I'd prefer not to change the current return types of utility methods:
I'd prefer to maintain backwards compatibility. If JSON is not returned I'd imagine we can safely throw an error with the text value instead (see TwitterError.js) Thoughts? |
Author
|
Yes, Rate-Limit is more like an exceptional case - I like the idea to throw an Error. |
|
This also happens if the path is incorrect (e.g. if the path is set to Throwing an error with the contents of It might be a good idea to check for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.