Skip to content

Commit a34be1f

Browse files
Fix forward_missing_to in HTTP::Headers (#16637)
`forward_missing_to` in `HTTP::Headers` is wrong because we explicitly don't want to forward all methods, as discovered in #16622. The only relevant forwarded methods seem to be `clear` and `object_id`. In `HTTP::Headers::Key` it seems entirely unused. Since this is a private internal type, it should be fine to remove without replacement.
1 parent 8fa7f90 commit a34be1f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/http/headers.cr

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ struct HTTP::Headers
99

1010
# :nodoc:
1111
record Key, name : String do
12-
forward_missing_to @name
13-
1412
def hash(hasher)
1513
name.each_byte do |c|
1614
hasher = normalize_byte(c).hash(hasher)
@@ -348,7 +346,13 @@ struct HTTP::Headers
348346
invalid_value_char(value).nil?
349347
end
350348

351-
forward_missing_to @hash
349+
def clear
350+
@hash.clear
351+
end
352+
353+
def object_id
354+
@hash.object_id
355+
end
352356

353357
private def unsafe_add(key, value : String)
354358
key = wrap(key)

0 commit comments

Comments
 (0)