Sha256: 3ab3881fd366c80dd313aa9ad1e19571482f0b7fafa57a63278c9d7286a3da77

Contents?: true

Size: 523 Bytes

Versions: 4

Compression:

Stored size: 523 Bytes

Contents

class Puppet::HTTP::Response
  attr_reader :nethttp, :url

  def initialize(nethttp, url)
    @nethttp = nethttp
    @url = url
  end

  def code
    @nethttp.code.to_i
  end

  def reason
    @nethttp.message
  end

  def body
    @nethttp.body
  end

  def read_body(&block)
    raise ArgumentError, "A block is required" unless block_given?

    @nethttp.read_body(&block)
  end

  def success?
    @nethttp.is_a?(Net::HTTPSuccess)
  end

  def [](name)
    @nethttp[name]
  end

  def drain
    body
    true
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
puppet-6.14.0 lib/puppet/http/response.rb
puppet-6.14.0-x86-mingw32 lib/puppet/http/response.rb
puppet-6.14.0-x64-mingw32 lib/puppet/http/response.rb
puppet-6.14.0-universal-darwin lib/puppet/http/response.rb