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

Definition of 'parsed_response' method in httparty.rbs is wrong. #466

Open
andredriem opened this issue Oct 28, 2023 · 0 comments
Open

Definition of 'parsed_response' method in httparty.rbs is wrong. #466

andredriem opened this issue Oct 28, 2023 · 0 comments

Comments

@andredriem
Copy link
Contributor

andredriem commented Oct 28, 2023

In the file httparty.rbs, the method parsed_response is inaccurately documented to return a string. However, upon examining the source code, it's clear that the parsed_response method's return type is determined by the Content-Type header of the HTTP response. The potential return types include:

  • nil (if the HTTP response has no body),
  • String,
  • Array[Array[untyped]], or
  • Hash.

It's important to note that users have the ability to override the parser, as illustrated in the code documentation. This flexibility allows for a variety of user-defined return types, making this a potentially common scenario. Given this recommended usage of the API, it would be wise to change the return type of 'parsed_response' to 'Object'.

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

No branches or pull requests

1 participant