def request( method, path, params )
      read_timeout = params.delete(:read_timeout)
      request_max_retries = params.delete(:max_retries) || max_retries
      body = extract_body(params)
      path = expand_path(path, params)

      params[:retries] = retries = 0
      instrument(path, body, params) do
        begin
          response =
            case method
            when :head
              connection.head(path) { |req| req.options[:timeout] = read_timeout if read_timeout }

            when :get
              connection.get(path) { |req|
                req.body = body if body
                req.options[:timeout] = read_timeout if read_timeout
              }

            when :put
              connection.put(path, body) { |req| req.options[:timeout] = read_timeout if read_timeout }

            when :post
              connection.post(path, body) { |req| req.options[:timeout] = read_timeout if read_timeout }

            when :delete
              connection.delete(path) { |req|
                req.body = body if body
                req.options[:timeout] = read_timeout if read_timeout
              }

            else
              raise ArgumentError, "unknown HTTP request method: #{method.inspect}"
            end

          handle_errors response

        # wrap Faraday errors with appropriate Elastomer::Client error classes
        rescue Faraday::Error::ClientError => boom
          error = wrap_faraday_error(boom, method, path)
          if error.retry? && RETRYABLE_METHODS.include?(method) && (retries += 1) <= request_max_retries
            params[:retries] = retries
            sleep retry_delay
            retry
          end
          raise error
        rescue OpaqueIdError => boom
          reset!
          raise boom
        end
      end
    end
def request( method, path, params )
      read_timeout = params.delete(:read_timeout)
      request_max_retries = params.delete(:max_retries) || max_retries
      body = extract_body(params)
      path = expand_path(path, params)

      params[:retries] = retries = 0
      instrument(path, body, params) do
        begin
          response =
            case method
            when :head
              connection.head(path) { |req| req.options[:timeout] = read_timeout if read_timeout }

            when :get
              connection.get(path) { |req|
                req.body = body if body
                req.options[:timeout] = read_timeout if read_timeout
              }

            when :put
              connection.put(path, body) { |req| req.options[:timeout] = read_timeout if read_timeout }

            when :post
              connection.post(path, body) { |req| req.options[:timeout] = read_timeout if read_timeout }

            when :delete
              connection.delete(path) { |req|
                req.body = body if body
                req.options[:timeout] = read_timeout if read_timeout
              }

            else
              raise ArgumentError, "unknown HTTP request method: #{method.inspect}"
            end

          handle_errors response

        # wrap Faraday errors with appropriate Elastomer::Client error classes
        rescue Faraday::Error::ClientError => boom
          error = wrap_faraday_error(boom, method, path)
          if error.retry? && RETRYABLE_METHODS.include?(method) && (retries += 1) <= request_max_retries
            params[:retries] = retries
            sleep retry_delay
            retry
          end
          raise error
        rescue OpaqueIdError => boom
          reset!
          raise boom
        end
      end
    end
Internal: Sends an HTTP request to the server. If the `params` Hash
 contains a :body key, it will be deleted from the Hash and the value
 will be used as the body of the request.

 method - The HTTP method to send [:head, :get, :put, :post, :delete]
 path   - The path as a String
 params - Parameters Hash
   :body         - Will be used as the request body
   :read_timeout - Optional read timeout (in seconds) for the request
   :max_retires  - Optional retry number for the request

 Returns a Faraday::Response
 Raises an Elastomer::Client::Error on 4XX and 5XX responses
 rubocop:disable Metrics/MethodLength