Sha256: 88d2c30d2a726695e80c7c07e5dd27291006343b6b47a44eb97a74dfa48e90bf

Contents?: true

Size: 414 Bytes

Versions: 1

Compression:

Stored size: 414 Bytes

Contents

class Midori::Response
  attr_accessor :status, :header, :body

  def initialize(code=200, header= Midori::Const::DEFAULT_HEADER, body='')
    @status = Midori::Const::STATUS_CODE[code]
    @header = header
    @body = body
  end

  def generate_header
    @header.map do |key, value|
      "#{key}: #{value}\r\n"
    end.join
  end

  def to_s
    "HTTP/1.1 #{@status}\r\n#{generate_header}\r\n#{@body}"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
em-midori-0.0.6 lib/em-midori/response.rb