Class: Idempo::ConcurrentRequestErrorApp

Inherits:
Object
  • Object
show all
Defined in:
lib/idempo/concurrent_request_error_app.rb

Constant Summary collapse

RETRY_AFTER_SECONDS =
2.to_s

Class Method Summary collapse

Class Method Details

.call(env) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/idempo/concurrent_request_error_app.rb', line 4

def self.call(env)
  res = {
    ok: false,
    error: {
      message: "Another request with this idempotency key is still in progress, please try again later"
    }
  }
  [429, {"Retry-After" => RETRY_AFTER_SECONDS, "Content-Type" => "application/json"}, [JSON.pretty_generate(res)]]
end