Sha256: 691c4809b77b3c6028777d84d6cc725c6c32e5aaebbb220f215666aa3f3a792b

Contents?: true

Size: 677 Bytes

Versions: 8

Compression:

Stored size: 677 Bytes

Contents

# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2019-2023, by Samuel Williams.

require_relative "multiple"
require_relative "../cookie"

module Protocol
	module HTTP
		module Header
			# The Cookie HTTP request header contains stored HTTP cookies previously sent by the server with the Set-Cookie header.
			class Cookie < Multiple
				def to_h
					cookies = self.collect do |string|
						HTTP::Cookie.parse(string)
					end
					
					cookies.map{|cookie| [cookie.name, cookie]}.to_h
				end
			end
			
			# The Set-Cookie HTTP response header sends cookies from the server to the user agent.
			class SetCookie < Cookie
			end
		end
	end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
protocol-http-0.44.0 lib/protocol/http/header/cookie.rb
protocol-http-0.43.0 lib/protocol/http/header/cookie.rb
protocol-http-0.42.0 lib/protocol/http/header/cookie.rb
protocol-http-0.41.0 lib/protocol/http/header/cookie.rb
protocol-http-0.40.0 lib/protocol/http/header/cookie.rb
protocol-http-0.39.0 lib/protocol/http/header/cookie.rb
protocol-http-0.38.0 lib/protocol/http/header/cookie.rb
protocol-http-0.37.0 lib/protocol/http/header/cookie.rb