ruby / ruby/gem_rbs_collection

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

Open Beginner friendly
#466 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
303
Forks
136
Avg merge
5h 15m
Merged PRs (30d)
6

Description

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'.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with httparty.rbs and compare its parsed_response definition with the behavior in lib/httparty/parser.rb. Review examples/custom_parsers.rb for the supported override behavior, then update the signature and verify that it covers the documented response cases and custom parser returns.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
tooling
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.