class Lucky::RequestIdHandler

Overview

Sets the HTTP::Server::Context#request_id value

Configure the set_request_id Proc to return a new String value on each request. This can be used to group logs and such that may be ran asynchronously.

Lucky::RequestIdHandler.configure do |settings|
  settings.set_request_id = ->(context : HTTP::Server::Context) {
    UUID.random.to_s
  }
end

Included Modules

Defined in:

lucky/request_id_handler.cr

Constant Summary

HABITAT_SETTINGS = [{decl: set_request_id : Proc(HTTP::Server::Context, String) | ::Nil = nil, example: nil, validation: nil}] of Nil

Class Method Summary

Instance Method Summary

Instance methods inherited from class Object

blank? : Bool blank?, present? : Bool present?

Class Method Detail

def self.configure(&) #

[View source]
def self.settings #

[View source]

Instance Method Detail

def call(context) #

[View source]
def settings #

[View source]