puma icon indicating copy to clipboard operation
puma copied to clipboard

client.rb - rename local variable `body` to `parser_body`

Open MSP-Greg opened this issue 9 months ago • 1 comments

Description

The Client#setup_body method is about 100 lines. While checking an issue where a request was processed correctly but was added to the reactor when it shouldn't be, I noticed the following code: https://github.com/puma/puma/blob/ca201ef69757f8830b636251b0af7a51270eb68a/lib/puma/client.rb#L459-L464

Client has a readable attribute body, an instance variable @body, and the method has a local variable body, which is set to @parser.body.

This PR renames the local variable to parser_body, which may help with clarity. It obviously currently works, but I prefer code that doesn't have name collisions between method local variables and class/module variables...

Note that JRuby head is failing in CI... See #3632.

Your checklist for this pull request

  • [x] I have reviewed the guidelines for contributing to this repository.
  • [ ] I have added (or updated) appropriate tests if this PR fixes a bug or adds a feature.
  • [x] My pull request is 100 lines added/removed or less so that it can be easily reviewed.
  • [ ] If this PR doesn't need tests (docs change), I added [ci skip] to the title of the PR.
  • [ ] If this closes any issues, I have added "Closes #issue" to the PR description or my commit messages.
  • [ ] I have updated the documentation accordingly.
  • [x] All new and existing tests passed, including Rubocop.

MSP-Greg avatar Mar 15 '25 00:03 MSP-Greg

This has been merged into #3582, so...

MSP-Greg avatar Aug 22 '25 19:08 MSP-Greg