Class: MicroserviceDSL::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/microservice_dsl/middleware.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



3
4
5
# File 'lib/microservice_dsl/middleware.rb', line 3

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/microservice_dsl/middleware.rb', line 7

def call(env)
  if env[MicroserviceDSL.rack_hop_header] && !env[MicroserviceDSL.rack_hop_header].blank?
    MicroserviceDSL.current_hop = env[MicroserviceDSL.rack_hop_header]
  else
    MicroserviceDSL.current_hop = "1"
  end
  MicroserviceDSL.next_hop = 0
  
  @app.call(env)
end