Sha256: 9dbc2c3189e81efe4cf854b655aa647956a043bb6d4ed7a291e08ba46320475d

Contents?: true

Size: 558 Bytes

Versions: 515

Compression:

Stored size: 558 Bytes

Contents

class Puppet::Network::HTTP::Response
  def initialize(handler, response)
    @handler = handler
    @response = response
  end

  def respond_with(code, type, body)
    format = Puppet::Network::FormatHandler.format_for(type)
    mime = format.mime
    charset = format.charset

    if charset
      if body.is_a?(String) && body.encoding != charset
        body.encode!(charset)
      end

      mime += "; charset=#{charset.name.downcase}"
    end

    @handler.set_content_type(@response, mime)
    @handler.set_response(@response, body, code)
  end
end

Version data entries

515 entries across 515 versions & 2 rubygems

Version Path
puppet-7.34.0 lib/puppet/network/http/response.rb
puppet-7.34.0-x86-mingw32 lib/puppet/network/http/response.rb
puppet-7.34.0-x64-mingw32 lib/puppet/network/http/response.rb
puppet-7.34.0-universal-darwin lib/puppet/network/http/response.rb
puppet-7.33.0 lib/puppet/network/http/response.rb
puppet-7.33.0-x86-mingw32 lib/puppet/network/http/response.rb
puppet-7.33.0-x64-mingw32 lib/puppet/network/http/response.rb
puppet-7.33.0-universal-darwin lib/puppet/network/http/response.rb
puppet-7.32.1 lib/puppet/network/http/response.rb
puppet-7.32.1-x86-mingw32 lib/puppet/network/http/response.rb
puppet-7.32.1-x64-mingw32 lib/puppet/network/http/response.rb
puppet-7.32.1-universal-darwin lib/puppet/network/http/response.rb
puppet-7.31.0 lib/puppet/network/http/response.rb
puppet-7.31.0-x86-mingw32 lib/puppet/network/http/response.rb
puppet-7.31.0-x64-mingw32 lib/puppet/network/http/response.rb
puppet-7.31.0-universal-darwin lib/puppet/network/http/response.rb
puppet-7.30.0 lib/puppet/network/http/response.rb
puppet-7.30.0-x86-mingw32 lib/puppet/network/http/response.rb
puppet-7.30.0-x64-mingw32 lib/puppet/network/http/response.rb
puppet-7.30.0-universal-darwin lib/puppet/network/http/response.rb