Sha256: cd75b058698c61e4e956d6fc4614a85d7368c86f61d8ae034d41ccd1c3b5522c
Contents?: true
Size: 1.3 KB
Versions: 3
Compression:
Stored size: 1.3 KB
Contents
module Rodauth module Rails module Feature module InternalRequest def post_configure super return unless internal_request? self.class.define_singleton_method(:internal_request) do |route, opts = {}, &blk| url_options = ::Rails.application.config.action_mailer.default_url_options || {} scheme = url_options[:protocol] port = url_options[:port] port||= Rack::Request::DEFAULT_PORTS[scheme] if Rack.release < "2" host = url_options[:host] host_with_port = host && port ? "#{host}:#{port}" : host env = { "HTTP_HOST" => host_with_port, "rack.url_scheme" => scheme, "SERVER_NAME" => host, "SERVER_PORT" => port, }.compact opts = opts.merge(env: env) { |k, v1, v2| v2.merge(v1) } super(route, opts, &blk) end end private def rails_controller_around return yield if internal_request? super end def rails_instrument_request return yield if internal_request? super end def rails_instrument_redirection return yield if internal_request? super end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems