Skip to content

net-http: Allow symbol based hashes for headers - #1750

Merged
soutaro merged 3 commits into
ruby:masterfrom
thisguycodes:patch-2
Mar 22, 2024
Merged

soutaro merged 3 commits into
ruby:masterfrom
thisguycodes:patch-2

Conversation

@thisguycodes

Copy link
Copy Markdown
Contributor

These methods work fine with headers given as Hash[Symbol, untyped]. I noticed when I got some squiggly lines in some of my methods that I already know work. I also defined headers as a type alias rather than copy-pasting the same definition everywhere (I can undo this if not desired).

I did (Hash[String, untyped] | Hash[Symbol, untyped]) rather than Hash[String | Symbol, untyped] because hashes with mixed key types can allow name collisions which gives unexpected behavior.

I also feel like we can do better than untyped for the values, but leaving it for now.

These methods work fine with headers given as `Hash[Symbol, untyped]`. I noticed when I got some squiggly lines in some of my methods that I already know work. I also defined `headers` as a type alias rather than copy-pasting the same definition everywhere (I can undo this if not desired).

I did `(Hash[String, untyped] | Hash[Symbol, untyped])` rather than `Hash[String | Symbol, untyped]` because hashes with mixed key types can allow name collisions which gives unexpected behavior.

I also feel like we can do better than `untyped` for the values, but leaving it for now.
@thisguycodes thisguycodes changed the title Allow symbol based hashes for headers net-http Allow symbol based hashes for headers Feb 7, 2024
@thisguycodes thisguycodes changed the title net-http Allow symbol based hashes for headers net-http: Allow symbol based hashes for headers Feb 7, 2024
@soutaro
soutaro enabled auto-merge March 22, 2024 03:22
@soutaro soutaro added this to the RBS 3.5 milestone Mar 22, 2024

@soutaro soutaro left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@soutaro
soutaro added this pull request to the merge queue Mar 22, 2024
Merged via the queue into ruby:master with commit 78effe5 Mar 22, 2024
@thisguycodes
thisguycodes deleted the patch-2 branch March 22, 2024 03:32
@soutaro soutaro added the Released PRs already included in the released version label Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Released PRs already included in the released version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants