Class: SidekiqAlive::Server::HttpServer::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/sidekiq_alive/server/http_server.rb

Overview

Request class for HTTP server

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, method = nil, path = nil, proto = nil) ⇒ Request

Returns a new instance of Request.



15
16
17
18
19
20
21
# File 'lib/sidekiq_alive/server/http_server.rb', line 15

def initialize(data, method = nil, path = nil, proto = nil)
  @header = {}
  @data = data
  @method = method
  @path = path
  @proto = proto
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



13
14
15
# File 'lib/sidekiq_alive/server/http_server.rb', line 13

def data
  @data
end

#headerObject (readonly)

Returns the value of attribute header.



13
14
15
# File 'lib/sidekiq_alive/server/http_server.rb', line 13

def header
  @header
end

#methodObject (readonly)

Returns the value of attribute method.



13
14
15
# File 'lib/sidekiq_alive/server/http_server.rb', line 13

def method
  @method
end

#pathObject (readonly)

Returns the value of attribute path.



13
14
15
# File 'lib/sidekiq_alive/server/http_server.rb', line 13

def path
  @path
end

#protoObject (readonly)

Returns the value of attribute proto.



13
14
15
# File 'lib/sidekiq_alive/server/http_server.rb', line 13

def proto
  @proto
end

Instance Method Details

#content_lengthObject



23
24
25
26
27
28
# File 'lib/sidekiq_alive/server/http_server.rb', line 23

def content_length
  len = @header["Content-Length"]
  return if len.nil?

  len.to_i
end