Skip to content

Commit 40ec4be

Browse files
Cast value to string if it isn't a string or nil
1 parent c2596dd commit 40ec4be

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/protocol/http/header/split.rb

+5-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@ class Split < Array
1717
#
1818
# @parameter value [String | Nil] the raw header value containing multiple entries separated by commas, or `nil` for an empty header.
1919
def initialize(value = nil)
20-
if value
20+
case value
21+
when String
2122
super(value.split(COMMA))
23+
when nil
24+
super()
2225
else
23-
super()
26+
super([value.to_s])
2427
end
2528
end
2629

0 commit comments

Comments
 (0)