Module: VCR::Middleware::Excon::LegacyMethods Private

Included in:
RequestHandler
Defined in:
lib/vcr/middleware/excon/legacy_methods.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Contains legacy methods only needed when integrating with older versions of Excon.

Instance Method Summary collapse

Instance Method Details

#queryObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

based on: github.com/geemus/excon/blob/v0.7.8/lib/excon/connection.rb#L117-132


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/vcr/middleware/excon/legacy_methods.rb', line 10

def query
  @query ||= case request_params[:query]
    when String
      "?#{request_params[:query]}"
    when Hash
      qry = '?'
      for key, values in request_params[:query]
        if values.nil?
          qry << key.to_s << '&'
        else
          for value in [*values]
            qry << key.to_s << '=' << CGI.escape(value.to_s) << '&'
          end
        end
      end
      qry.chop! # remove trailing '&'
    else
      ''
  end
end