Class: Fluent::PluginHelper::HttpServer::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/plugin_helper/http_server/request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request) ⇒ Request

Returns a new instance of Request.



26
27
28
29
30
# File 'lib/fluent/plugin_helper/http_server/request.rb', line 26

def initialize(request)
  @request = request
  path = request.path
  @path, @query_string = path.split('?', 2)
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



24
25
26
# File 'lib/fluent/plugin_helper/http_server/request.rb', line 24

def path
  @path
end

#query_stringObject (readonly)

Returns the value of attribute query_string.



24
25
26
# File 'lib/fluent/plugin_helper/http_server/request.rb', line 24

def query_string
  @query_string
end

Instance Method Details

#bodyObject



36
37
38
# File 'lib/fluent/plugin_helper/http_server/request.rb', line 36

def body
  @request.body && @request.body.read
end

#queryObject



32
33
34
# File 'lib/fluent/plugin_helper/http_server/request.rb', line 32

def query
  @query_string && CGI.parse(@query_string)
end