method

build_test_request

Importance_0
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: Behavior
build_test_request(path, params: nil, headers: {}, session: {}, env: {}) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File actioncable/lib/action_cable/connection/test_case.rb, line 210
          def build_test_request(path, params: nil, headers: {}, session: {}, env: {})
            wrapped_headers = ActionDispatch::Http::Headers.from_hash(headers)

            uri = URI.parse(path)

            query_string = params.nil? ? uri.query : params.to_query

            request_env = {
              "QUERY_STRING" => query_string,
              "PATH_INFO" => uri.path
            }.merge(env)

            if wrapped_headers.present?
              ActionDispatch::Http::Headers.from_hash(request_env).merge!(wrapped_headers)
            end

            TestRequest.create(request_env).tap do |request|
              request.session = session.with_indifferent_access
              request.cookie_jar = cookies
            end
          end
Register or log in to add new notes.