Class: Request::Timer

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/faraday/request/timer.rb

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/faraday/request/timer.rb', line 6

def call(env)
  started_at = Time.now
  app        = @app.call(env)
  ended_at   = Time.now

  app.env[:duration] = ended_at - started_at
  app
end