class Rakie::HttpResponse

Constants

PARSE_CONTENT
PARSE_HEAD
PARSE_HEADERS

Attributes

content[RW]
head[RW]
headers[RW]

Public Class Methods

new() click to toggle source
# File lib/rakie/http_proto.rb, line 174
def initialize
  @head = Head.new
  @headers = {}
  @content = ''
end

Public Instance Methods

serialize() click to toggle source
# File lib/rakie/http_proto.rb, line 180
def serialize
  data = ""

  data += "#{head.version} #{head.status} #{head.message}"
  data += "\r\n"

  headers_list = []
  headers.each do |k, v|
    headers_list << "#{k}: #{v}"
  end

  data += headers_list.join("\r\n")
  data += "\r\n\r\n"

  data += content
end