Class: Jets::Mega::Request::Source

Inherits:
Object
  • Object
show all
Defined in:
lib/jets/mega/request/source.rb

Instance Method Summary collapse

Constructor Details

#initialize(event) ⇒ Source

Returns a new instance of Source.



3
4
5
6
# File 'lib/jets/mega/request/source.rb', line 3

def initialize(event)
  @event = event
  @source_request = Rack::Request.new(event: event)
end

Instance Method Details

#bodyObject



8
9
10
11
12
13
14
# File 'lib/jets/mega/request/source.rb', line 8

def body
  if @source_request.body.respond_to?(:read)
    body = @source_request.body.read
    @source_request.body.rewind
  end
  body
end

#content_lengthObject



16
17
18
# File 'lib/jets/mega/request/source.rb', line 16

def content_length
  @source_request.content_length.to_i
end