You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: rack_request.rb
    path of file: ./repos/ruby/spec/bundler/support/artifice/helpers
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

require "rack/test"
require "bundler/vendored_net_http"

module Artifice
  module Net
    # This is an internal object that can receive Rack requests
    # to the application using the Rack::Test API
    class RackRequest
      include Rack::Test::Methods
      attr_reader :app

      def initialize(app)
        @app = app
      end

    
      def request(req, body = nil, &block)
        rack_request = RackRequest.new(self.class.endpoint)

        req.each_header do |header, value|
          rack_request.header(header, value)
        end

        scheme = use_ssl? ? "https" : "http"
        prefix = "#{scheme}://#{addr_port}"
        body_stream_contents = req.body_stream.read if req.body_stream

        response = rack_request.request("#{prefix}#{req.path}",
          { method: req.method, input: body || req.body || body_stream_contents })

        make_net_http_response(response, &block)
      end