Sha256: aadec37da177b696a14015aac4e5cf23601837d2bade62ca2a174ec733e1e058
Contents?: true
Size: 1.18 KB
Versions: 2
Compression:
Stored size: 1.18 KB
Contents
# rubocop:disable Metrics/ParameterLists class SiteHub class ForwardProxy include Rules, Resolver attr_reader :downstream_client, :sitehub_cookie_name, :sitehub_cookie_path, :id, :mapped_path, :mapped_url def initialize(sitehub_cookie_path: nil, sitehub_cookie_name:, id:, rule: nil, mapped_path:, mapped_url:) @downstream_client = DownstreamClient.new @sitehub_cookie_path = sitehub_cookie_path @sitehub_cookie_name = sitehub_cookie_name @id = id @rule = rule @mapped_path = mapped_path @mapped_url = mapped_url end def call(env) request = env[REQUEST] request.map(mapped_path, mapped_url) downstream_client.call(request).tap do |response| response.set_cookie(sitehub_cookie_name, path: (sitehub_cookie_path || request.path), value: id) end end def ==(other) expected = [other.mapped_path, other.mapped_url, other.rule, other.id, other.sitehub_cookie_name, other.sitehub_cookie_path] expected == [mapped_path, mapped_url, rule, id, sitehub_cookie_name, sitehub_cookie_path] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sitehub-0.4.7 | lib/sitehub/forward_proxy.rb |
sitehub-0.4.6 | lib/sitehub/forward_proxy.rb |