class

Lucky::RequestIdHandler

Inherits Habitat::SettingsHelpers < Habitat::TempConfig < HTTP::Handler < Reference < Object

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

Constants

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

Class methods

configure
Source
settings
Source

Instance methods

settings
Source

Nested types