mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
20 lines
302 B
Ruby
20 lines
302 B
Ruby
module RequestStore
|
|
class Middleware
|
|
def initialize(app)
|
|
@app = app
|
|
end
|
|
|
|
def call(env)
|
|
RequestStore.clear!
|
|
@app.call(env)
|
|
end
|
|
end
|
|
|
|
def self.store
|
|
Thread.current[:request_store] ||= {}
|
|
end
|
|
|
|
def self.clear!
|
|
Thread.current[:request_store] = {}
|
|
end
|
|
end |