diff --git a/lib/httpx/plugins/cookies/cookie.rb b/lib/httpx/plugins/cookies/cookie.rb index 2b8db659..9289a1c7 100644 --- a/lib/httpx/plugins/cookies/cookie.rb +++ b/lib/httpx/plugins/cookies/cookie.rb @@ -107,6 +107,8 @@ module HTTPX @path ||= "/" raise ArgumentError, "name must be specified" if @name.nil? + + @name = @name.to_s end def expires @@ -122,7 +124,7 @@ module HTTPX # Returns a string for use in the Cookie header, i.e. `name=value` # or `name="value"`. def cookie_value - "#{@name}=#{Scanner.quote(@value)}" + "#{@name}=#{Scanner.quote(@value.to_s)}" end alias_method :to_s, :cookie_value diff --git a/sig/plugins/cookies/cookie.rbs b/sig/plugins/cookies/cookie.rbs index 7568d8d3..03670504 100644 --- a/sig/plugins/cookies/cookie.rbs +++ b/sig/plugins/cookies/cookie.rbs @@ -31,19 +31,17 @@ module HTTPX def valid_for_uri?: (uri) -> bool - def self.new: (Cookie) -> untyped - | (cookie_attributes) -> untyped - | (String, String) -> untyped - | (String, String, cookie_attributes) -> untyped + def self.new: (Cookie) -> instance + | (cookie_attributes) -> instance + | (_ToS, _ToS, ?cookie_attributes) -> instance def self.path_match?: (String, String) -> bool private def initialize: (cookie_attributes) -> untyped - | (String, String) -> untyped - | (String, String, cookie_attributes?) -> untyped - + | (_ToS, _ToS, ?cookie_attributes) -> untyped + def acceptable_from_uri?: (uri) -> bool end end