Sha256: 61701b0f394623ef47e30403543cc4794236afd188766158295ad563f1505c18

Contents?: true

Size: 937 Bytes

Versions: 32

Compression:

Stored size: 937 Bytes

Contents

# frozen_string_literal: true

# Adapts Net::HTTPResponse to Puppet::HTTP::Response
#
# @api public
class Puppet::HTTP::ResponseNetHTTP < Puppet::HTTP::Response
  # Create a response associated with the URL.
  #
  # @param [URI] url
  # @param [Net::HTTPResponse] nethttp The response
  def initialize(url, nethttp)
    super(url, nethttp.code.to_i, nethttp.message)

    @nethttp = nethttp
  end

  # (see Puppet::HTTP::Response#body)
  def body
    @nethttp.body
  end

  # (see Puppet::HTTP::Response#read_body)
  def read_body(&block)
    raise ArgumentError, "A block is required" unless block_given?

    @nethttp.read_body(&block)
  end

  # (see Puppet::HTTP::Response#success?)
  def success?
    @nethttp.is_a?(Net::HTTPSuccess)
  end

  # (see Puppet::HTTP::Response#[])
  def [](name)
    @nethttp[name]
  end

  # (see Puppet::HTTP::Response#each_header)
  def each_header(&block)
    @nethttp.each_header(&block)
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
puppet-8.10.0 lib/puppet/http/response_net_http.rb
puppet-8.10.0-x86-mingw32 lib/puppet/http/response_net_http.rb
puppet-8.10.0-x64-mingw32 lib/puppet/http/response_net_http.rb
puppet-8.10.0-universal-darwin lib/puppet/http/response_net_http.rb
puppet-8.9.0 lib/puppet/http/response_net_http.rb
puppet-8.9.0-x86-mingw32 lib/puppet/http/response_net_http.rb
puppet-8.9.0-x64-mingw32 lib/puppet/http/response_net_http.rb
puppet-8.9.0-universal-darwin lib/puppet/http/response_net_http.rb
puppet-8.8.1 lib/puppet/http/response_net_http.rb
puppet-8.8.1-x86-mingw32 lib/puppet/http/response_net_http.rb
puppet-8.8.1-x64-mingw32 lib/puppet/http/response_net_http.rb
puppet-8.8.1-universal-darwin lib/puppet/http/response_net_http.rb
puppet-8.7.0 lib/puppet/http/response_net_http.rb
puppet-8.7.0-x86-mingw32 lib/puppet/http/response_net_http.rb
puppet-8.7.0-x64-mingw32 lib/puppet/http/response_net_http.rb
puppet-8.7.0-universal-darwin lib/puppet/http/response_net_http.rb
puppet-8.6.0 lib/puppet/http/response_net_http.rb
puppet-8.6.0-x86-mingw32 lib/puppet/http/response_net_http.rb
puppet-8.6.0-x64-mingw32 lib/puppet/http/response_net_http.rb
puppet-8.6.0-universal-darwin lib/puppet/http/response_net_http.rb