Class: Immunio::HTTPFinisher

Inherits:
Object
  • Object
show all
Defined in:
lib/immunio/plugins/http_finisher.rb

Overview

Rack middleware running at the very end of the stack to finish HTTP requests.

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ HTTPFinisher

Returns a new instance of HTTPFinisher.



6
7
8
# File 'lib/immunio/plugins/http_finisher.rb', line 6

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/immunio/plugins/http_finisher.rb', line 10

def call(env)
  status, headers, body = @app.call(env)
  if Request.current
    Immunio.logger.debug { "Finishing request in HTTPFinisher" }
    [status, headers, BodyWrapper.new(body)]
  else
    [status, headers, body]
  end
end