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

livecheck: restrict POST hashes to symbol keys #19352

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

samford
Copy link
Member

@samford samford commented Feb 22, 2025

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

I initially set the type for livecheck's post_form and post_json hashes to allow either a string or symbol key. I used string keys in the documentation, as there will inevitably be some form field names that would pose a problem for symbols (e.g., E-mail uses a hyphen, 1twothree starts with a digit, etc.). However, I remembered that we can simply use quote symbols like :"E-mail" to handle these situations, as they have the flexibility of a string while still being a symbol.

With that in mind, this updates related type signatures to only allow symbol keys and updates documentation and tests accordingly. The documentation example contains a hyphenated form field, so it demonstrates how to handle names that don't work as a bare symbol.

I initially set the type for livecheck's `post_form` and `post_json`
hashes to allow either a string or symbol key. I used string keys in
the documentation, as there will inevitably be some form field names
that would pose a problem for symbols (e.g., `E-mail` uses a hyphen,
`1twothree` starts with a digit, etc.). However, I remembered that we
can simply use quote symbols like `:"E-mail"` to handle these
situations, as they have the flexibility of a string while still being
a symbol.

With that in mind, this updates related type signatures to only allow
symbol keys and updates documentation and tests accordingly. The
documentation example contains a hyphenated form field, so it
demonstrates how to handle names that don't work as a bare symbol.
@samford samford mentioned this pull request Feb 22, 2025
7 tasks
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

Successfully merging this pull request may close these issues.

1 participant