def rack_env(request)
      uri = URI.parse(request.path)

      # Minimum required variables according to Rack Spec
      env = {
        "REQUEST_METHOD" => "GET",
        "SCRIPT_NAME" => "",
        "PATH_INFO" => uri.path,
        "QUERY_STRING" => uri.query,
        "SERVER_NAME" => uri.host,
        "SERVER_PORT" => uri.port.to_s,
        "HTTP_HOST" => uri.host,
        "REMOTE_ADDR" => request.headers.delete("REMOTE_ADDR"),
        "rack.url_scheme" => uri.scheme,
        "rack.input" => ""
      }

      env.merge!(build_headers(request.headers))
    end
def rack_env(request)
      uri = URI.parse(request.path)

      # Minimum required variables according to Rack Spec
      env = {
        "REQUEST_METHOD" => "GET",
        "SCRIPT_NAME" => "",
        "PATH_INFO" => uri.path,
        "QUERY_STRING" => uri.query,
        "SERVER_NAME" => uri.host,
        "SERVER_PORT" => uri.port.to_s,
        "HTTP_HOST" => uri.host,
        "REMOTE_ADDR" => request.headers.delete("REMOTE_ADDR"),
        "rack.url_scheme" => uri.scheme,
        "rack.input" => ""
      }

      env.merge!(build_headers(request.headers))
    end
Build Rack env from request