Sha256: 46b54f5177b3b6ee87d93d1c71c69933e2c69242f5bd4d79d4fe6630ac5dbcd5
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
# frozen_string_literal: true module Rack # @api public # @since 0.1.0 class BlastWave::RequestId < BlastWave::Middleware # @since 0.1.0 include Qonfig::Configurable # @return [String] # # @api public # @since 0.1.0 REQUEST_ID_ENV_KEY = 'rack.blastwave.request_id' # @since 0.1.0 configuration { setting :id_randomizer, -> { SecureRandom.hex } } # @param app [Object] # @return [void] # # @api private # @since 0.1.0 def initialize(app) super Initializer.call(app) end # @param env [Hash] # @return [Object] # # @see Rack::BlastWave::Middleware # # @api private # @since 0.1.0 def call(env) append_request_id!(env) super end private # @return [String] # # @see generate_request_id # # @api private # @since 0.1.0 def append_request_id!(env) env[REQUEST_ID_ENV_KEY] = generate_request_id end # @return [String] # # @api private # @since 0.1.0 def generate_request_id self.class.config.settings.id_randomizer.call end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
blast_wave-0.0.0 | lib/blast_wave/request_id.rb |