Get full HTTP request in HTTP format.

 @return [String]
482270
def raw
      headers = http_headers.map { |k, v| "#{k}: #{v}\r\n" }.join
      format "%s %s %s\r\n%s\r\n%s", request_method.upcase, fullpath, env["SERVER_PROTOCOL"], headers, body_string
    end
220266
def send_http_request
      net_http_options = [uri.host, uri.port, use_ssl: true]
      ActiveSupport::Notifications.instrument 'request.yt' do |payload|
        payload[:method] = @method
        payload[:request_uri] = uri
        payload[:response] = Net::HTTP.start(*net_http_options) do |http|
          http.request http_request
        end
      end
    end
852328
def get(query_url,
            headers: {})
      HttpRequest.new(HttpMethodEnum::GET,
                      query_url,
                      headers: headers)
    end
797195
def http(&block)
      http = Net::HTTP.new(@uri.host, @uri.port)
      if @uri.port == 443
        http.use_ssl = true
        http.verify_mode = OpenSSL::SSL::VERIFY_NONE
      end
      return http.start(&block) if block_given?
      http
    end
238552
def request_format
        format = request_params[:format]

        if format.nil? && context_scope.respond_to?(:request)
          request = context_scope.request
          format = request.format.to_sym.to_s if request.respond_to?(:format)
        end

        format = "json" unless format && respond_to?("to_#{format}")

        format
      end
231722
def url_get_html(url_str)
      url = URI.parse(URI.encode(url_str)) # first get total size
      req = Net::HTTP::Get.new(url.to_s)
      res = Net::HTTP.start(url.host, url.port) { |http| http.request(req) }
      res.body
    end
79507
def do_request method, endpoint, data = {}
      url = get_url(endpoint, method)
      options = {
        format: :json
      }

      # Allow custom HTTParty args.
      options = options.merge(@httparty_args)

      # Set headers.
      options[:headers] = {
        "User-Agent" => "WooCommerce API Client-Ruby/#{WooCommerce::VERSION}",
        "Accept" => "application/json"
      }
      options[:headers]["Content-Type"] = "application/json;charset=utf-8" if !data.empty?

      # Set basic authentication.
      if @is_ssl
        options[:verify] = @verify_ssl

        if @query_string_auth
          options.merge!(query: {
            consumer_key: @consumer_key,
            consumer_secret: @consumer_secret
          })
        else
          options.merge!(basic_auth: {
            username: @consumer_key,
            password: @consumer_secret
          })
        end
      end

      options.merge!(debug_output: $stdout) if @debug_mode
      options.merge!(body: data.to_json) if !data.empty?

      HTTParty.send(method, url, options)
    end
1198411
def build_http_request(klass, path, params = nil, body = nil)
      path += '?' + URI.encode_www_form(params) unless params.nil?
      req = klass.new(path)
      req.body = URI.encode_www_form(body) unless body.nil?
      Etcd::Log.debug("Built #{klass} path:'#{path}'  body:'#{req.body}'")
      req
    end
1226152
def get(req)
    target_uri = req.header.request_uri
    return nil unless @challengeable.find { |uri, ok|
      Util.uri_part_of(target_uri, uri) and ok
    }
    return @cred if @cred
    Util.hash_find_value(@auth) { |uri, cred|
      Util.uri_part_of(target_uri, uri)
    }
  end
281634
def method_missing(method, *args)
      if @httpmethods.include? method
        @client.httprequest(method.to_s, path, *args)
      else
        @path_parts << method.to_s
        args.each do |arg|
          @path_parts << arg
        end
        self
      end
    end
33690
public function getFullUrl()
    {
        $isSecure = $this->isSecure();
        $srvProtocol = strtolower($this->server->get('SERVER_PROTOCOL'));
        $protocol = substr($srvProtocol, 0, strpos($srvProtocol, '/')).(($isSecure) ? 's' : '');
        $port = $this->getPort();
        $port = ((!$isSecure && $port != '80') || ($isSecure && $port != '443')) ? ":$port" : '';

        return $protocol.'://'.$this->getHost().$port.$this->server->get('REQUEST_URI');
    }
231661
def requested_version
      accept_headers = request.headers["HTTP_ACCEPT"]
      return nil if accept_headers.nil?
      parts = accept_headers.split(",").map(&:strip)
      requested = parts.map{|part| part.match(/version=(\d+)/)[1] if part.match(/version=\d+/)}.detect{|i| !i.nil?}
      requested.to_i unless requested.nil?
    end
180560
def get(urls)
    if urls.nil? or urls.empty? then
      return []
    end

    urls = [urls] if not urls.kind_of? Array
    urls.each_with_index do |url, i|
      @reqs << Request.new(i, url.to_s)
    end

    return collate_results(perform())
  end
385057
def perform
      uri = URI(url)
      response = Net::HTTP.start(uri.hostname, uri.port,
        :use_ssl => uri.scheme == 'https' ) { |http|
        Orchestrate.config.logger.debug "Performing #{method.to_s.upcase} request to \"#{url}\""
        http.request(request(uri))
      }
      Response.new(response)
    end
520864
def parse_request(data)
      data.strip!
      space = data.index(" ")
      if space
        cmd = data[0, space]
        param = data[space+1, data.length - space]
        param = nil if param.strip.size == 0
      else
        cmd = data
        param = nil
      end

      [cmd.downcase, param]
    end
908801
def request(method = :get, path = '/files/', params = {})
      response = @api_connection.send method, path, params
      response.body
    end
1253767
def raw
      formated_headers = headers.map { |k, v| "#{k}: #{v}\r\n" }.join
      status_text = Rack::Utils::HTTP_STATUS_CODES[status]
      format "HTTP/%s %s %s\r\n%s\r\n%s", @version, status, status_text, formated_headers, body.join
    end